/*******************************************************************
 * 
 *  Copyright C 2005 by Amlogic, Inc. All Rights Reserved.
 *
 *  Description: 
 *
 *  Author: Amlogic Software
 *  Created: May 11 01:17:34 2007
 *
 *******************************************************************/
#include <sys/types.h>
#include <aw_playlist2.h>
#include <listop.h>
#include <math.h>
#include <app/avi/avi_sub.h>

#include "../menu.h"
#include "../../user.h"
#include "../aw_sys_app.h"
#include "../aw_init_display.h"
#include "../aw_gui_app.h"
#include "../fs_playlist.h"
#include "../aw_sys_app.h"
#include "../aw_init_display.h"
#include "../aw_AVI_app.h"
#include "../aw_PIC_app.h"
#include "../aw_VOB_app.h"
#include "../aw_GPLAYER_app.h"
#include "../aw_RM_app.h"
#include "../aw_TXT_app.h"
#include "../aw_config.h"
#include "../fs_playlist.h"
#include "../logo_dat.h" 
#include "ctrlconvert.h" 

#include "gplayer_app.h"
#include "filenav.h"
#include "AVTimer.h"
#include "t_filelist.h"
#include "aw_app.h"
#include "LogoEvent.h"
#include "WinPicInfoBarEvent.h"
#include "NetmenuSetupEvent.h"

#define FILENUMBER  7
#define COPYLISTNUMBER  4
#define SHOW_FILE_NAME_LENGTH  50
#define FILELIST_WIDE    490
#define FILENUM_ONEPAGE 7
#define STOP 0 
#define PLAY 1 

static INT8U FilelistView_onShow_Flag = 0;
static INT8U lv_first_item_index = 0 ;
static INT8U lv_focused_item_index = 0 ;
static INT8U lv_filelist_status = 0;
static INT8U String_roll_state = UNROLL ;
static INT8U WaitFor = 3 ;
static INT8U waitting = 0 ;
static INT8U showlogowait = 0 ;
static INT8U IsProcessBarOnShow = 0 ;
static INT8U save_pic_slide_show_mode = 0 ;
static INT8U FileMaskFlag = 7;
 INT32S cur_level_index = 0;
static INT32U curDirTotalItem = 0;
static AVTimer_t caption_moving_timer = 0;
//static AVTimer_t Music_Play_dly ;

static unsigned char transparentlevel = 0xf ;
const short volume_level[8]={ 0, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x5fff, 0x7fff} ;

char PathBackUp[MAX_DIR_PATH_LENGTH] ;
char gpFileList[FILENUMBER][SHOW_FILE_NAME_LENGTH] ;
char copyFileList[COPYLISTNUMBER][SHOW_FILE_NAME_LENGTH] ;
char gCurFileName[MAX_DIR_PATH_LENGTH] ;
char gCurDirName[MAX_DIR_PATH_LENGTH] ;
char preview_item_name[256]={0};

INT8U keep_current_index = 0;
INT8U LogoResum = 0 ;
INT8U LogoHome = 0 ;
INT8U ucCopyFileFlag = 1;
INT8U WinTypeChoice = 0;
INT8U ucUseUsbFlag = 0;
INT32U gGetFileType = AW_PIC_LIST|AW_AUDIO_LIST|AW_VIDEO_LIST|MEDIA_TXT|NAV_IS_DIR;
INT32U TotalItems = 0;
INT32U Filelist_Bar_Str_len = 0 ;
char *unsupport_item_name = NULL;
INT8U Music_Play_Dlying = 0;
INT8U Music_Play_flag = 0;	//0 stop, 1 play, 2 stop waiting to play, 3 stat play waiting success.

int preview_video = 0;
FILEINFO file_info_onshow;
AVTimer_t preview_switch_timer = 0;
VIDEO_INFO video_inf;
char have_videoinfo_flag = 0;
char fileshowtime[20] = {0};
#ifdef TIME_SEARCH
INT8U TimeSearchFlag = 0;
#endif
extern AUDIO_STREAM_INFO pInfo;
extern unsigned filelist_music[MAX_FILE_NODIR];
extern unsigned filelist_video[MAX_FILE_NODIR];
extern int pic_slide_show_mode;
extern int total_count_music;
extern int total_count_video;
extern int total_count_item;
extern INT8U isMute ;  // Sound is Mute or UnMute
extern INT8U FileListOnShowFlag;
extern INT16U AudioStatus ;
extern INT32U cur_focus_level;
extern INT32U NODIR_FLAG;
extern INT32U ONLYDIR_FLAG; 
extern INT32U cur_filetype_flag;
extern INT32S roll_string_timeout ;
extern char CurDriver[10];
extern char gCurOnlyMp3FileName[256] ;
extern unsigned char Volume_Value ; // 0 ~ 7
extern unsigned char user_power_flag;
//static INT8U Audio_App_State_Special = STOP ;
extern INT8U CurrentOsdSize;

static void FileListViewCheck_nodir(PHWND hwnd);

static void caption_moving_time_func_1(void *arg);

INT32S updateFileListArrowShowState2(INT32S have_more_file, 
									 INT8U next_flag, 
									 INT32S currItemIndex, 
									 INT32U totalItem,INT32U Num
									 );

//void Music_Play_dly_fun(void *arg) ;

void updateVolumeState(unsigned char Volume);

void vosd_selfroll_string(PHWND hwnd, int index, char *filestring, 
	COORD opposite_play_x, COORD opposite_play_y, AVTimer_t *caption_moving_timer, 
	TIMER_CB_t caption_moving_time_func, INT32U StopRollStrLen, INT8U rolltype, INT8U IsRollShortStr);

extern struct tm * localtime(const time_t   *__timer);

void StringCopyByLen(char *listname, char *filename, INT32S len, int nodir_flag) ;


#ifdef TV_MODE_1080P
char *SpeTable_14[25]=
{
    (char*)ICON_SPECTRUM0_14_1080P, (char*)ICON_SPECTRUM1_14_1080P, (char*)ICON_SPECTRUM2_14_1080P, (char*)ICON_SPECTRUM3_14_1080P, (char*)ICON_SPECTRUM4_14_1080P,
    (char*)ICON_SPECTRUM5_14_1080P, (char*)ICON_SPECTRUM6_14_1080P, (char*)ICON_SPECTRUM7_14_1080P, (char*)ICON_SPECTRUM8_14_1080P, (char*)ICON_SPECTRUM9_14_1080P,
    (char*)ICON_SPECTRUM10_14_1080P,(char*)ICON_SPECTRUM11_14_1080P,(char*)ICON_SPECTRUM12_14_1080P,(char*)ICON_SPECTRUM13_14_1080P,(char*)ICON_SPECTRUM14_14_1080P,
    (char*)ICON_SPECTRUM15_14_1080P,(char*)ICON_SPECTRUM16_14_1080P,(char*)ICON_SPECTRUM17_14_1080P,(char*)ICON_SPECTRUM18_14_1080P,(char*)ICON_SPECTRUM19_14_1080P,
    (char*)ICON_SPECTRUM20_14_1080P,(char*)ICON_SPECTRUM21_14_1080P,(char*)ICON_SPECTRUM22_14_1080P,(char*)ICON_SPECTRUM23_14_1080P,(char*)ICON_SPECTRUM24_14_1080P
};
#endif
#ifdef TV_MODE_720P		
char *SpeTable_14[25]=
{
    (char*)ICON_SPECTRUM0_14_720P, (char*)ICON_SPECTRUM1_14_720P, (char*)ICON_SPECTRUM2_14_720P, (char*)ICON_SPECTRUM3_14_720P, (char*)ICON_SPECTRUM4_14_720P,
    (char*)ICON_SPECTRUM5_14_720P, (char*)ICON_SPECTRUM6_14_720P, (char*)ICON_SPECTRUM7_14_720P, (char*)ICON_SPECTRUM8_14_720P, (char*)ICON_SPECTRUM9_14_720P,
    (char*)ICON_SPECTRUM10_14_720P,(char*)ICON_SPECTRUM11_14_720P,(char*)ICON_SPECTRUM12_14_720P,(char*)ICON_SPECTRUM13_14_720P,(char*)ICON_SPECTRUM14_14_720P,
    (char*)ICON_SPECTRUM15_14_720P,(char*)ICON_SPECTRUM16_14_720P,(char*)ICON_SPECTRUM17_14_720P,(char*)ICON_SPECTRUM18_14_720P,(char*)ICON_SPECTRUM19_14_720P,
    (char*)ICON_SPECTRUM20_14_720P,(char*)ICON_SPECTRUM21_14_720P,(char*)ICON_SPECTRUM22_14_720P,(char*)ICON_SPECTRUM23_14_720P,(char*)ICON_SPECTRUM24_14_720P
};
#endif
char *SpeTable_8[25]=
{
    (char*)ICON_SPECTRUM0_8_480, (char*)ICON_SPECTRUM1_8_480, (char*)ICON_SPECTRUM2_8_480, (char*)ICON_SPECTRUM3_8_480, (char*)ICON_SPECTRUM4_8_480,
    (char*)ICON_SPECTRUM5_8_480, (char*)ICON_SPECTRUM6_8_480, (char*)ICON_SPECTRUM7_8_480, (char*)ICON_SPECTRUM8_8_480, (char*)ICON_SPECTRUM9_8_480,
    (char*)ICON_SPECTRUM10_8_480,(char*)ICON_SPECTRUM11_8_480,(char*)ICON_SPECTRUM12_8_480,(char*)ICON_SPECTRUM13_8_480,(char*)ICON_SPECTRUM14_8_480,
    (char*)ICON_SPECTRUM15_8_480,(char*)ICON_SPECTRUM16_8_480,(char*)ICON_SPECTRUM17_8_480,(char*)ICON_SPECTRUM18_8_480,(char*)ICON_SPECTRUM19_8_480,
    (char*)ICON_SPECTRUM20_8_480,(char*)ICON_SPECTRUM21_8_480,(char*)ICON_SPECTRUM22_8_480,(char*)ICON_SPECTRUM23_8_480,(char*)ICON_SPECTRUM24_8_480
};


#ifdef TV_MODE_1080P
static unsigned short used_palette_common[6][480] = 
{
{
0x556b,  0xf6,   0xdfed,  0xf5,   0xc560,  0xf7,   0xa4e7,  0xf6,   0x2ae5,  0xf7,   
0x18aa,  0xf6,   0xd6ea,  0xf5,   0xd9ea,  0xf5,   0xe4eb,  0xf5,   0x60a8,  0xf6,   0x12a4,  0xf7,   0x2d24,  0xf7,   0x7223,  0xf7,   
0xa662,  0xf7,   0xd16b,  0xf5,   0xdb6a,  0xf5,   0xa726,  0xf6,   0xad27,  0xf6,   0xdcaa,  0xf5,   0x61e2,  0xf7,   0xb161,  0xf7,   
0xb261,  0xf7,   0xb521,  0xf7,   0xf8a0,  0xf7,   0x9c6a,  0xf5,   0x58ab,  0xf5,   0x9aaa,  0xf5,   0x9da9,  0xf5,   0x9f29,  0xf5,   
0x676b,  0xf5,   0xa8ea,  0xf5,   0xea69,  0xf5,   0x6a23,  0xf7,   0x9d29,  0xf5,   0x9ea9,  0xf5,   0x5fa9,  0xf5,   0x9e29,  0xf5,   
0xa9e9,  0xf5,   0x5da6,  0xf6,   0x6ce2,  0xf7,   0xb061,  0xf7,   0xa9e1,  0xf7,   0xdd60,  0xf7,   0x1eaa,  0xf5,   0x5da9,  0xf5,   
0x6069,  0xf5,   0x60e9,  0xf5,   0xa228,  0xf5,   0x5a66,  0xf6,   0xa328,  0xf5,   0xac25,  0xf6,   0xa965,  0xf6,   0xeea4,  0xf6,   
0x69e2,  0xf7,   0x6ae2,  0xf7,   0x6ba2,  0xf7,   0x6ca2,  0xf7,   0xa861,  0xf7,   0xb721,  0xf7,   0xb321,  0xf7,   0xb221,  0xf7,   
0xb3e1,  0xf7,   0x582c,  0xf4,   0x99ac,  0xf4,   0xdc2a,  0xf4,   0x5ea8,  0xf5,   0x2269,  0xf5,   0x61a9,  0xf5,   0x6269,  0xf5,   
0xa067,  0xf5,   0x2866,  0xf6,   0x6b25,  0xf6,   0x69e5,  0xf6,   0xaaa4,  0xf6,   0x25e3,  0xf7,   0x27a3,  0xf7,   0x2ce3,  0xf7,   
0xb121,  0xf7,   0xf5e0,  0xf7,   0x1c2c,  0xf4,   0x9f2a,  0xf4,   0xddaa,  0xf4,   0xe0aa,  0xf4,   0x2229,  0xf5,   0x6329,  0xf5,   
0x23e9,  0xf5,   0x24a9,  0xf5,   0x2669,  0xf5,   0xa167,  0xf5,   0xa467,  0xf5,   0xa4e4,  0xf6,   0xa064,  0xf6,   0x67a5,  0xf6,   
0x6d25,  0xf6,   0x6ea5,  0xf6,   0xe6e4,  0xf6,   0xe3a3,  0xf6,   0xe823,  0xf6,   0xeba3,  0xf6,   0xf1a3,  0xf6,   0x2b23,  0xf7,   
0x28e2,  0xf7,   0x29a2,  0xf7,   0x2aa2,  0xf7,   0x2b62,  0xf7,   0x3363,  0xf7,   0x2e62,  0xf7,   0x6e62,  0xf7,   0x6f21,  0xf7,   
0xaba1,  0xf7,   0xad61,  0xf7,   0xe1ea,  0xf4,   0xe329,  0xf4,   0xe66a,  0xf4,   0x2469,  0xf5,   0x2528,  0xf5,   0x25e8,  0xf5,   
0x6668,  0xf5,   0x2768,  0xf5,   0x6928,  0xf5,   0x69e8,  0xf5,   0x1fa5,  0xf6,   0xaa27,  0xf5,   0xa727,  0xf5,   0xa8a7,  0xf5,   
0xe5e6,  0xf5,   0x22a6,  0xf6,   0x2465,  0xf6,   0x61a5,  0xf6,   0xea26,  0xf5,   0xe766,  0xf5,   0x26a5,  0xf6,   0xe923,  0xf6,   
0x2962,  0xf7,   0x2a63,  0xf7,   0x6c62,  0xf7,   0x6d62,  0xf7,   0x7021,  0xf7,   0xb1e1,  0xf7,   0xb2e1,  0xf7,   0x26a8,  0xf5,   
0xe869,  0xf4,   0x26e8,  0xf5,   0x28a8,  0xf5,   0x2968,  0xf5,   0x6828,  0xf5,   0x68e8,  0xf5,   0x2a68,  0xf5,   0x69a8,  0xf5,   
0x6aa8,  0xf5,   0x69e7,  0xf5,   0xd663,  0xf6,   0x6aa7,  0xf5,   0x6ba7,  0xf5,   0xab27,  0xf5,   0xabe6,  0xf5,   0xec66,  0xf5,   
0xeda6,  0xf5,   0x2ee5,  0xf6,   0x7024,  0xf6,   0x9e2c,  0xf3,   0xea68,  0xf4,   0x2928,  0xf5,   0x29e8,  0xf5,   0x2867,  0xf5,   
0x2967,  0xf5,   0x2ae8,  0xf5,   0x68a7,  0xf5,   0x2a27,  0xf5,   0x2b27,  0xf5,   0x69a7,  0xf5,   0x6a67,  0xf5,   0x6b67,  0xf5,   
0x6aa7,  0xf5,   0x6b67,  0xf5,   0x6c67,  0xf5,   0xaca7,  0xf5,   0xace6,  0xf5,   0x7164,  0xf6,   0x2a62,  0xf7,   0x2b62,  0xf7,   
0x2c22,  0xf7,   0x2d22,  0xf7,   0xe22a,  0xf3,   0x2aa7,  0xf5,   0x2ba7,  0xf5,   0x2ae7,  0xf5,   0x6a67,  0xf5,   0x6be7,  0xf5,   
0x6b27,  0xf5,   0x6ce6,  0xf5,   0x6c26,  0xf5,   0xad66,  0xf5,   0x21eb,  0xf3,   0xb4a0,  0xf7,   0xed27,  0xf4,   0xb2a1,  0xf7,   
0xae22,  0xf6,   0xdba5,  0xf4,   0xf223,  0xf5,   0x9e63,  0xf5,   0x6264,  0xf4,   0x21a3,  0xf5,   0x6a25,  0xf3,   0xa823,  0xf4,   
0x75a1,  0xf6,   0x7521,  0xf6,   0xece3,  0xf3,   0xe9a2,  0xf4,   0xef63,  0xf3,   0x6822,  0xf5,   0x70e2,  0xf4,   0xee21,  0xf4,   
0xf31f,  0xf6,   0xd81f,  0xf7,   0xe35f,  0xf7,   0x36df,  0xf8,   0x7347,  0xf9,   0xb108,  0xf9,   0xab8b,  0xf9,   0x6410,  0xf9,   
0x2ec9,  0xfa,   0xe88d,  0xf9,   0x2694,  0xf9,   0x6cd3,  0xf9,   0xd617,  0xf8,   0x34d6,  0xf9,   0xac4a,  0xfa,   0x2e8d,  0xfa,   
0xb699,  0xf8,   0x7293,  0xf9,   0xee99,  0xf8,   0x275f,  0xf8,   0x33df,  0xf8,   0x2fdf,  0xf8,   0x2e1f,  0xf8,   0x329f,  0xf8,   
0x351f,  0xf8,   0x3a9f,  0xf8,   0xf19f,  0xf7,    	
}
,
{
0x55f,  0xf8,   0x321f,  0xf8,   0x5560,  0xf8,   0x5360,  0xf8,   
0x18a0,  0xf8,   0x30a0,  0xf8,   0x3920,  0xf8,   0x3760,  0xf8,   0x4de1,  0xf8,   0x11a1,  0xf8,   0x7a1,  0xf8,   0xaa1,  0xf8,   
0x5a2,  0xf8,   0x1ee1,  0xf8,   0x3262,  0xf8,   0xca6b,  0xf7,   0xd22d,  0xf7,   0xf3e1,  0xf7,   0xcfa3,  0xf7,   0x56ad,  0xf7,   
0xc521,  0xf7,   0xc921,  0xf7,   0xd461,  0xf7,   0xcf60,  0xf7,   0xe421,  0xf7,   0xd0e0,  0xf7,   0xf6a1,  0xf7,   0xf1a0,  0xf7,   
0xf8a0,  0xf7,   0xeaa0,  0xf7,   0xe760,  0xf7,   0xf360,  0xf7,   0xe5a0,  0xf7,   0x512a,  0xf7,   0x96e8,  0xf7,   0x9a27,  0xf7,   
0x53a9,  0xf7,   0xd2e1,  0xf7,   0x9fe6,  0xf7,   0xcd21,  0xf7,   0xa764,  0xf7,   0xc6e2,  0xf7,   0xade3,  0xf7,   0xefe1,  0xf7,   
0xdc2b,  0xf6,   0x5ce7,  0xf7,   0xa4a5,  0xf7,   0xf520,  0xf7,   0xaa64,  0xf7,   0xd929,  0xf6,   0xd66a,  0xf6,   0x21a8,  0xf7,   
0xd430,  0xf5,   0xdb21,  0xf7,   0xec60,  0xf7,   0x93b1,  0xf5,   0x95f2,  0xf5,   0xd3b0,  0xf5,   0xd96e,  0xf5,   0xeee0,  0xf7,   
0xfac,  0xf6,   0x9570,  0xf5,   0x1dec,  0xf6,   0x9ee8,  0xf6,   0x5530,  0xf5,   0x57b0,  0xf5,   0x972f,  0xf5,   0x5ba9,  0xf6,   
0x216b,  0xf6,   0xa3e7,  0xf6,   0x58ef,  0xf5,   0x19aa,  0xf6,   0xe766,  0xf6,   0x7163,  0xf7,   0xa1e1,  0xf7,   0x1aee,  0xf5,   
0x9e61,  0xf7,   0xe8e0,  0xf7,   0x926b,  0xf5,   0x1ced,  0xf5,   0x2469,  0xf6,   0x6128,  0xf6,   0x1be3,  0xf7,   0x2c64,  0xf7,   
0x9ca1,  0xf7,   0xa521,  0xf7,   0x4862,  0xf7,   0x6627,  0xf6,   0x95a1,  0xf7,   0x9921,  0xf7,   0xa361,  0xf7,   0xa6e1,  0xf7,   
0xb2e1,  0xf7,   0x14eb,  0xf5,   0x572b,  0xf5,   0xdea9,  0xf5,   0xa9a6,  0xf6,   0x9761,  0xf7,   0x9fe1,  0xf7,   0xdead,  0xf4,   
0xe328,  0xf5,   0xd764,  0xf6,   0x2f24,  0xf7,   0xd6ab,  0xf4,   0xcb64,  0xf6,   0x196b,  0xf5,   0x6029,  0xf5,   0xa169,  0xf5,   
0xe827,  0xf5,   0xd067,  0xf5,   0x8de5,  0xf6,   0x982c,  0xf4,   0x9265,  0xf6,   0x62e9,  0xf5,   0x2b26,  0xf6,   0xdeaa,  0xf4,   
0x5c29,  0xf5,   0xe12a,  0xf4,   0xa4e8,  0xf5,   0x2d66,  0xf6,   0x54a8,  0xf5,   0x5bab,  0xf4,   0x63ab,  0xf4,   0xc620,  0xf7,   
0xe3a9,  0xf4,   0x27a8,  0xf5,   0x9061,  0xf7,   0x74a2,  0xf7,   0xe5e9,  0xf4,   0x9829,  0xf4,   0xde6b,  0xf3,   0xaa20,  0xf7,   
0xa1ab,  0xf3,   0xeb28,  0xf4,   0x8ea0,  0xf7,   0xada0,  0xf7,   0x7224,  0xf6,   0xb120,  0xf7,   0xb7e0,  0xf7,   0x652b,  0xf3,   
0x1a64,  0xf6,   0xaf65,  0xf5,   0x93e0,  0xf7,   0x87e0,  0xf7,   0x9fa2,  0xf6,   0x8b20,  0xf7,   0xf9a0,  0xf7,   0xe320,  0xf7,   
0xd721,  0xf5,   0x6221,  0xf5,   0x91e0,  0xf7,   0x94df,  0xf7,   0x1d5c,  0xf5,   0x621d,  0xf6,   0x669d,  0xf6,   0x351e,  0xf7,   
0x6257,  0xf4,   0x8e5f,  0xf7,   0xc5df,  0xf7,   0xcd5f,  0xf7,   0x6756,  0xf5,   0x5cdd,  0xf7,   0xcfdf,  0xf7,   0xaa99,  0xf6,   
0xd35e,  0xf7,   0xd91f,  0xf7,   0xf399,  0xf7,   0xaa51,  0xf7,   0xae14,  0xf7,   0xb157,  0xf7,   0x69f,  0xf8,   0x219e,  0xf8,   
0x165e,  0xf8,   0x1c9f,  0xf8,   0x315f,  0xf8,   0x39df,  0xf8,   0x129f,  0xf8,   0x1e9f,  0xf8,   0x389e,  0xf8,   0x334e,  0xf9,   
0x89e,  0xf8,   0xa258,  0xf8,   0xef4b,  0xf9,   0xb08e,  0xf9,   0x6dd1,  0xf9,   0x29d4,  0xf9,   0xf1e,  0xf8,   0x10de,  0xf8,   
0xabd0,  0xf9,   0x6553,  0xf9,   0xb0cf,  0xf9,   0x6c8b,  0xfa,   0x2e0c,  0xfa,   0xea8e,  0xf9,   0x2e8e,  0xfa,   0xa911,  0xf9,   
0x15d7,  0xf9,   0x61d4,  0xf9,   0x1a17,  0xf9,   0x68cf,  0xfa,   0x6c4d,  0xfa,   0xe5d0,  0xf9,   0xaacc,  0xfa,   0xd15a,  0xf8,   
0x6ccf,  0xfa,   0x5dd6,  0xf9,   0x294c,  0xfb,   0x8ddb,  0xf8,   0xd79b,  0xf8,   0x93dc,  0xf8,   0x4ade,  0xf8,   0x529e,  0xf8,   
0x5b9e,  0xf8,   0x355f,  0xf8,   0x471f,  0xf8,   0x629f,  0xf8,   0x581f,  0xf8,   0x60df,  0xf8,   0x4ddf,  0xf8,   0x4fde,  0xf8,   
0x305f,  0xf8,   0x38df,  0xf8,   0x371f,  0xf8,   0xbdf,  0xf8,   0x161f,  0xf8,   0x3adf,  0xf8,   0xf860,  0xf7,   0xf69f,  0xf7,   
0xf19f,  0xf7,   0xe3df,  0xf7,   0x2220,  0xf8,   0x2060,  0xf8,   0xdce0,  0xf7,   0x1a60,  0xf8,   0x17e0,  0xf8,   0x1460,  0xf8,   
0xf20,  0xf8,   0x920,  0xf8,   0x69f,  0xf8,   0xc4df,  0xf7,   
}
,
{
0x4ddf,  0xf8,   0x665f,  0xf8,   0xce0,  0xfa,   0x12a2,  0xfb,   0x5221,  0xf9,   0xd6e2,  0xf9,   
0x1020,  0xf8,   0xdb62,  0xf8,   0x14e0,  0xf8,   0x2120,  0xf8,   0x27e0,  0xf8,   0x2ee0,  0xf8,   0x29a0,  0xf8,   0x3260,  0xf8,   
0x30a0,  0xf8,   0x3adf,  0xf8,   0x2b60,  0xf8,   0x35a0,  0xf8,   0x1a20,  0xf8,   0x56a1,  0xf8,   0x9ee3,  0xf8,   0x24a1,  0xf8,   
0x2821,  0xf8,   0x2122,  0xf8,   0x1ae2,  0xf8,   0x2323,  0xf8,   0x1161,  0xf8,   0xdf22,  0xf7,   0xcf60,  0xf7,   0xd661,  0xf7,   
0xe261,  0xf7,   0xe961,  0xf7,   0xe421,  0xf7,   0xe7a1,  0xf7,   0xeca1,  0xf7,   0xe3e0,  0xf7,   0xe260,  0xf7,   0xe920,  0xf7,   
0xe760,  0xf7,   0xee60,  0xf7,   0xeae0,  0xf7,   0xf1a0,  0xf7,   0xf020,  0xf7,   0xdce0,  0xf7,   0xe5a0,  0xf7,   0xdea0,  0xf7,   
0xdb20,  0xf7,   0xe5e2,  0xf7,   0xdd62,  0xf7,   0xf521,  0xf7,   0xd9a0,  0xf7,   0xf6e1,  0xf7,   0x9beb,  0xf5,   0x94e4,  0xf7,   
0xdb62,  0xf7,   0xdee1,  0xf7,   0x8c23,  0xf7,   0xe061,  0xf7,   0xb363,  0xf7,   0xa163,  0xf7,   0x9623,  0xf7,   0x9463,  0xf7,   
0x97e3,  0xf7,   0xb27,  0xf7,   0xc9a2,  0xf7,   0x8be2,  0xf7,   0x8da2,  0xf7,   0x8f22,  0xf7,   0x90e2,  0xf7,   0x92a2,  0xf7,   
0x99e3,  0xf7,   0x9622,  0xf7,   0xcd61,  0xf7,   0x99a2,  0xf7,   0xd461,  0xf7,   0x4eac,  0xf6,   0xaba3,  0xf7,   0x136e,  0xf6,   
0x4d64,  0xf7,   0xd7a1,  0xf7,   0x1d2c,  0xf6,   0x5424,  0xf7,   0x68a4,  0xf7,   0x95e2,  0xf7,   0x9ce2,  0xf7,   0xe061,  0xf7,   
0x162c,  0xf6,   0xcee6,  0xf6,   0x92a8,  0xf6,   0x20ab,  0xf6,   0x9e68,  0xf6,   0xe568,  0xf6,   0x9b21,  0xf7,   0x9068,  0xf6,   
0x98e9,  0xf6,   0x5063,  0xf7,   0x9ee2,  0xf7,   0x7123,  0xf7,   0x19ab,  0xf6,   0x95e8,  0xf6,   0x4d23,  0xf7,   0x4ea3,  0xf7,   
0xdb26,  0xf6,   0x8ee1,  0xf7,   0xca4,  0xf7,   0xe166,  0xf6,   0xdea5,  0xf6,   0x5563,  0xf7,   0xaf61,  0xf7,   0x63a3,  0xf7,   
0xa1e1,  0xf7,   0x4ea2,  0xf7,   0x5022,  0xf7,   0x5562,  0xf7,   0x5c62,  0xf7,   0xa8a1,  0xf7,   0xcba0,  0xf7,   0x6d63,  0xf7,   
0xa6e1,  0xf7,   0xa521,  0xf7,   0x33e3,  0xf7,   0xea60,  0xf7,   0x7622,  0xf7,   0xb821,  0xf7,   0xb461,  0xf7,   0x8e61,  0xf7,   
0xde20,  0xf7,   0xe360,  0xf7,   0xa7a6,  0xf5,   0xaee4,  0xf6,   0x2ba5,  0xf6,   0x96e1,  0xf7,   0xd060,  0xf7,   0xd5a0,  0xf7,   
0x8fe0,  0xf7,   0xd760,  0xf7,   0xdaa0,  0xf7,   0xe860,  0xf7,   0xebe0,  0xf7,   0xd420,  0xf7,   0xf2a0,  0xf7,   0xf120,  0xf7,   
0xdc60,  0xf7,   0xe1a0,  0xf7,   0xf620,  0xf7,   0x59de,  0xf7,   0x925f,  0xf7,   0xce5f,  0xf7,   0x901f,  0xf7,   0xe31f,  0xf7,   
0xd71f,  0xf7,   0xab5f,  0xf7,   0xe4df,  0xf7,   0xe81f,  0xf7,   0xf29f,  0xf7,   0xf0df,  0xf7,   0xe54d,  0xf2,   0xa69e,  0xf7,   
0xd55e,  0xf7,   0xa09b,  0xf7,   0x6dc8,  0xf6,   0x9f99,  0xf7,   0xcb9e,  0xf7,   0x2d94,  0xf8,   0x5815,  0xf8,   0x6557,  0xf8,   
0x5298,  0xf8,   0x1adf,  0xf8,   0x21df,  0xf8,   0x2f9f,  0xf8,   0x331f,  0xf8,   0x3286,  0xf9,   0xb692,  0xf8,   0x268c,  0xf9,   
0xde91,  0xf8,   0xf34c,  0xf8,   0x28de,  0xf8,   0x369e,  0xf8,   0x5019,  0xf8,   0x315f,  0xf8,   0x259e,  0xf8,   0xe9e,  0xf8,   
0x10df,  0xf8,   0x2a9f,  0xf8,   0x385e,  0xf8,   0x34de,  0xf8,   0x23de,  0xf8,   0xee18,  0xf9,   0x5757,  0xfa,   0xa053,  0xfb,   
0xe491,  0xfb,   0x6793,  0xfb,   0x6197,  0xfa,   0xda19,  0xf9,   0xdc95,  0xfa,   0xd599,  0xf9,   0xd95c,  0xf8,   0xa89a,  0xf9,   
0x949d,  0xf8,   0x921a,  0xf9,   0xe5c,  0xf9,   0x705f,  0xf8,   0x6edf,  0xf8,   0x6d1f,  0xf8,   0x699f,  0xf8,   0x8a1e,  0xf8,   
0x4f9f,  0xf8,   0x609f,  0xf8,   0x73df,  0xf8,   0x371f,  0xf8,   0x621f,  0xf8,   0x6b5f,  0xf8,   0x67df,  0xf8,   0x645f,  0xf8,   
0x321f,  0xf8,   0x359f,  0xf8,   0xf860,  0xf7,   0xf69f,  0xf7,   0xf4df,  0xf7,   0x331f,  0xf8,   0xf19f,  0xf7,   0xefdf,  0xf7,   
0x2e1f,  0xf8,   0xec5f,  0xf7,   0xeaa0,  0xf7,   0xe8e0,  0xf7,   0xe720,  0xf7,   0xe3df,  0xf7,   0x2220,  0xf8,   0x2060,  0xf8,   
0x1960,  0xf8,   0x17e0,  0xf8,   0x1620,  0xf8,   0x12a0,  0xf8,   0xd0e0,  0xf7,   0xf20,  0xf8,   0xd60,  0xf8,   0xc89f,  0xf7,   
0x5a0,  0xf8,   0x4a0,  0xf8,      
}
,
{
0x30df,  0xf8,   0x6fdf,  0xf8,   0x3a20,  0xf8,   0x3920,  0xf8,   0x2d60,  0xf8,   0x31a0,  0xf8,   
0x2f60,  0xf8,   0x2ba1,  0xf8,   0x2661,  0xf8,   0x2be2,  0xf8,   0xc4e0,  0xf7,   0xf160,  0xf7,   0xe2a0,  0xf7,   0xf9e0,  0xf7,   
0xf820,  0xf7,   0xf120,  0xf7,   0xf3a0,  0xf7,   0xe961,  0xf7,   0xeb61,  0xf7,   0xeca0,  0xf7,   0xeda0,  0xf7,   0xe7e1,  0xf7,   
0xf720,  0xf7,   0x126a,  0xf7,   0x1569,  0xf7,   0x5d27,  0xf7,   0xd320,  0xf7,   0xeaa1,  0xf7,   0xe360,  0xf7,   0x1a28,  0xf7,   
0x1fa7,  0xf7,   0x62a6,  0xf7,   0xa9e4,  0xf7,   0x64e5,  0xf7,   0xa5e3,  0xf7,   0xe2a1,  0xf7,   0xcd20,  0xf7,   0xf1e1,  0xf7,   
0xf560,  0xf7,   0xeea0,  0xf7,   0xf4a0,  0xf7,   0x5aa4,  0xf7,   0xc7a0,  0xf7,   0xa423,  0xf7,   0xd020,  0xf7,   0xf620,  0xf7,   
0xa7e3,  0xf7,   0xe421,  0xf7,   0xd5a0,  0xf7,   0xed61,  0xf7,   0xe920,  0xf7,   0xe7a0,  0xf7,   0xebe0,  0xf7,   0x5824,  0xf7,   
0x5d24,  0xf7,   0x64e3,  0xf7,   0xafa2,  0xf7,   0xca60,  0xf7,   0xf2a1,  0xf7,   0xf3a1,  0xf7,   0xf020,  0xf7,   0xe420,  0xf7,   
0x572a,  0xf6,   0x5363,  0xf7,   0x5fa4,  0xf7,   0x6164,  0xf7,   0x62e4,  0xf7,   0x63e4,  0xf7,   0x65a3,  0xf7,   0x66a3,  0xf7,   
0xabe2,  0xf7,   0xace2,  0xf7,   0xdb21,  0xf7,   0xae22,  0xf7,   0xf461,  0xf7,   0xa923,  0xf7,   0xaaa2,  0xf7,   0xb1a1,  0xf7,   
0xef61,  0xf7,   0xa261,  0xf7,   0xe861,  0xf7,   0xf8e0,  0xf7,   0xf2e0,  0xf7,   0x9e5,  0xf7,   0x1a2a,  0xf6,   0x5d69,  0xf6,   
0xea61,  0xf7,   0xf0e1,  0xf7,   0xade6,  0xf6,   0xaee6,  0xf6,   0xef26,  0xf6,   0x2863,  0xf7,   0x2d23,  0xf7,   0xa8a2,  0xf7,   
0x74e3,  0xf7,   0x9f61,  0xf7,   0xe221,  0xf7,   0xe561,  0xf7,   0x156d,  0xf5,   0x9a30,  0xf4,   0x18ae,  0xf5,   0xdd2f,  0xf4,   
0x51e8,  0xf6,   0x606c,  0xf5,   0xad67,  0xf6,   0xaea6,  0xf6,   0xafa6,  0xf6,   0xefe5,  0xf6,   0x6f23,  0xf7,   0x9c21,  0xf7,   
0x75a2,  0xf7,   0x9d61,  0xf7,   0xb6a2,  0xf7,   0xa361,  0xf7,   0xa42b,  0xf5,   0xe869,  0xf5,   0x2b68,  0xf6,   0xa7a6,  0xf6,   
0xae66,  0xf6,   0xafa5,  0xf6,   0xf0a5,  0xf6,   0x31a4,  0xf7,   0x2b63,  0xf7,   0x32e4,  0xf7,   0x33e3,  0xf7,   0xe6e1,  0xf7,   
0xb861,  0xf7,   0xf1e0,  0xf7,   0xdf69,  0xf5,   0x6da7,  0xf6,   0xaf66,  0xf6,   0xe6e4,  0xf6,   0xb065,  0xf6,   0x29a3,  0xf7,   
0xb761,  0xf7,   0x6426,  0xf6,   0x66e6,  0xf6,   0xb165,  0xf6,   0x7462,  0xf7,   0xd9a0,  0xf7,   0xf520,  0xf7,   0xf360,  0xf7,   
0xa1a8,  0xf5,   0xa3a8,  0xf5,   0x21e6,  0xf6,   0x27e6,  0xf6,   0xa565,  0xf6,   0xe3e4,  0xf6,   0xe864,  0xf6,   0xee24,  0xf6,   
0x97ac,  0xf4,   0xd96b,  0xf4,   0xdaea,  0xf4,   0x1c6a,  0xf5,   0x1de9,  0xf5,   0x5f29,  0xf5,   0x6029,  0xf5,   0xe527,  0xf5,   
0x2667,  0xf6,   0x6926,  0xf6,   0x6a25,  0xf6,   0x67a5,  0xf6,   0x6b65,  0xf6,   0xac25,  0xf6,   0xace4,  0xf6,   0xefa3,  0xf6,   
0x31a3,  0xf7,   0xb5a1,  0xf7,   0x76e2,  0xf7,   0x7562,  0xf7,   0xf960,  0xf7,   0x2668,  0xf5,   0xd7e0,  0xf7,   0xf7e0,  0xf7,   
0x71e4,  0xf6,   0xea68,  0xf4,   0xf0a5,  0xf5,   0x2d26,  0xf5,   0xaf25,  0xf5,   0x5be5,  0xf5,   0xdfe4,  0xf5,   0xb920,  0xf7,   
0xfa20,  0xf7,   0xf6e0,  0xf7,   0xdca1,  0xf5,   0x6220,  0xf6,   0x5f9e,  0xf6,   0xe119,  0xf6,   0xeadd,  0xf7,   0x6498,  0xf7,   
0x6055,  0xf7,   0x420,  0xf8,   0x6f9f,  0xf8,   0x2621,  0xf8,   0xf121,  0xf7,   0xf7e0,  0xf7,   0xf0e0,  0xf7,   0xd0ad,  0xf6,   
0xdea9,  0xf6,   0xe261,  0xf7,   0xca20,  0xf7,   0x19e6,  0xf7,   0x6424,  0xf7,   0xf8a0,  0xf7,   0xf0a1,  0xf7,   0xa361,  0xf7,   
0xa6a1,  0xf7,   0x33e3,  0xf7,   0xe12b,  0xf4,   0xa6a8,  0xf5,   0x9961,  0xf7,   0x23e9,  0xf5,   0x97a0,  0xf7,   0xf7a0,  0xf7,   
0x1e1f,  0xf8,   0x20df,  0xf8,   0x789a,  0xf8,   0xb617,  0xf8,   0x149f,  0xf8,   0x2bcd,  0xfa,   0x2e8d,  0xfa,   0xb153,  0xf9,   
0x3257,  0xf9,   0x969a,  0xf8,   0xae54,  0xf9,   0xeb93,  0xf9,   0x1c59,  0xf9,   0x999b,  0xf8,   0xe2d9,  0xf8,   0x2852,  0xfa,   
0xa516,  0xf9,   0x6057,  0xf9,   0xa896,  0xf9,   0x4c9d,  0xf8,   0x9e5c,  0xf8,   0x2453,  0xfa,   0x925c,  0xf8,   0x161f,  0xf8,   
0x3adf,  0xf8,   0x1c20,  0xf8,   
}
,
{
0x51aa,  0xf7,   0x52aa,  0xf7,   0x516a,  0xf7,   0x11aa,  0xf7,   0x11aa,  0xf7,   0x54aa,  0xf7,   
0x11eb,  0xf7,   0x11ea,  0xf7,   0x122b,  0xf7,   0x122a,  0xf7,   0x16a9,  0xf7,   0xd26b,  0xf6,   0x126b,  0xf7,   0xd2eb,  0xf6,   
0xd42a,  0xf6,   0xd32b,  0xf6,   0xd8a9,  0xf6,   0x93ab,  0xf6,   0xb0a2,  0xf7,   0x93eb,  0xf6,   0x966a,  0xf6,   0xdc28,  0xf6,   
0x542b,  0xf6,   0x54ab,  0xf6,   0x54ab,  0xf6,   0x156b,  0xf6,   0x152b,  0xf6,   0x152b,  0xf6,   0xd5eb,  0xf5,   0x15ab,  0xf6,   
0x156b,  0xf6,   0x18aa,  0xf6,   0xd62b,  0xf5,   0xd62b,  0xf5,   0xd62b,  0xf5,   0xd02b,  0xf5,   0x96ab,  0xf5,   0x6028,  0xf6,   
0x91eb,  0xf5,   0x96eb,  0xf5,   0xd9ea,  0xf5,   0xa2e6,  0xf6,   0xe9a5,  0xf6,   0x6de3,  0xf7,   0xb5e1,  0xf7,   0x932b,  0xf5,   
0x57ac,  0xf5,   0x576b,  0xf5,   0x5da7,  0xf6,   0x54eb,  0xf5,   0x182c,  0xf5,   0x57ec,  0xf5,   0x95ea,  0xf5,   0x9baa,  0xf5,   
0x562a,  0xf5,   0x18ec,  0xf5,   0x572b,  0xf5,   0x18ac,  0xf5,   0x982a,  0xf5,   0x5b6b,  0xf5,   0xa6e6,  0xf6,   0xebe5,  0xf6,   
0xf860,  0xf7,   0x99ac,  0xf4,   0xd9ac,  0xf4,   0xd96c,  0xf4,   0x596a,  0xf5,   0x5d2a,  0xf5,   0xe468,  0xf5,   0x9a6c,  0xf4,   
0x9a6c,  0xf4,   0x9a2c,  0xf4,   0x9a2c,  0xf4,   0xd9ab,  0xf4,   0x1b6a,  0xf5,   0x5f6a,  0xf5,   0xae64,  0xf6,   0x5aec,  0xf4,   
0x5aac,  0xf4,   0x9d2b,  0xf4,   0xddaa,  0xf4,   0x61a9,  0xf5,   0xe667,  0xf5,   0x2966,  0xf6,   0x1bec,  0xf4,   0x5b6c,  0xf4,   
0xe22a,  0xf4,   0x2429,  0xf5,   0x6ca5,  0xf6,   0xb064,  0xf6,   0x1c6c,  0xf4,   0xdd2c,  0xf3,   0x1cac,  0xf4,   0x1cec,  0xf4,   
0xddec,  0xf3,   0x1fab,  0xf4,   0x5f2b,  0xf4,   0xa0aa,  0xf4,   0xa867,  0xf5,   0xeb66,  0xf5,   0x2de5,  0xf6,   0x6ee5,  0xf6,   
0xf3e3,  0xf6,   0xde6c,  0xf3,   0xdf2c,  0xf3,   0x626a,  0xf4,   0xa3ea,  0xf4,   0xe5a9,  0xf4,   0x2828,  0xf5,   0x2968,  0xf5,   
0xaa27,  0xf5,   0xed26,  0xf5,   0x7761,  0xf7,   0xb7a1,  0xf7,   0x5e6d,  0xf3,   0xa02c,  0xf3,   0xa0ac,  0xf3,   0xa0ec,  0xf3,   
0xa0ec,  0xf3,   0xa16c,  0xf3,   0xa12c,  0xf3,   0xa1ac,  0xf3,   0xa22b,  0xf3,   0xe22b,  0xf3,   0x23aa,  0xf4,   0x64ea,  0xf4,   
0x65ea,  0xf4,   0xa6e9,  0xf4,   0xe8e8,  0xf4,   0x2a28,  0xf5,   0x2a28,  0xf5,   0x2aa8,  0xf5,   0x2b27,  0xf5,   0x2b27,  0xf5,   
0x2b67,  0xf5,   0x2b67,  0xf5,   0x6ae7,  0xf5,   0x6be7,  0xf5,   0x6c67,  0xf5,   0x6ca7,  0xf5,   0xade6,  0xf5,   0xae26,  0xf5,   
0xae26,  0xf5,   0xeea6,  0xf5,   0x3025,  0xf6,   0x30e5,  0xf6,   0x3164,  0xf6,   0x7164,  0xf6,   0x7224,  0xf6,   0x7264,  0xf6,   
0xb323,  0xf6,   0xb363,  0xf6,   0xf4a3,  0xf6,   0xf4e2,  0xf6,   0xf4e2,  0xf6,   0x3562,  0xf7,   0x76e2,  0xf7,   0xdfed,  0xf2,   
0xa2eb,  0xf3,   0xa36b,  0xf3,   0xe3eb,  0xf3,   0xe46b,  0xf3,   0xe4ab,  0xf3,   0xe4eb,  0xf3,   0xe52b,  0xf3,   0xe56a,  0xf3,   
0xe56a,  0xf3,   0xe5ea,  0xf3,   0xe62a,  0xf3,   0xe62a,  0xf3,   0x24ea,  0xf4,   0x25aa,  0xf4,   0x26ea,  0xf4,   0x266a,  0xf4,   
0x272a,  0xf4,   0x26a9,  0xf4,   0x272a,  0xf4,   0x66e9,  0xf4,   0x6769,  0xf4,   0xa8a9,  0xf4,   0x2c27,  0xf5,   0x6c67,  0xf5,   
0x6ce6,  0xf5,   0xada6,  0xf5,   0xada6,  0xf5,   0xd8e3,  0xf6,   0xae26,  0xf5,   0x4da1,  0xf7,   0xef65,  0xf5,   0xb3e3,  0xf6,   
0x3622,  0xf7,   0xb821,  0xf7,   0xb8a1,  0xf7,   0xe66a,  0xf3,   0x26aa,  0xf4,   0x26aa,  0xf4,   0x276a,  0xf4,   0x2769,  0xf4,   
0x27a9,  0xf4,   0x27a9,  0xf4,   0xeca7,  0xf4,   0xf9e0,  0xf7,   0xfa20,  0xf7,   0xb1c5,  0xf9,   0x2f88,  0xfa,   0x2e49,  0xfa,   
0x6d89,  0xfa,   0x6a0b,  0xfa,   0xac0a,  0xfa,   0x6cca,  0xfa,   0x270d,  0xfa,   0x244e,  0xfa,   0xa190,  0xf9,   0xac8a,  0xfa,   
0x8f9b,  0xf8,   0x694c,  0xfa,   0x69cc,  0xfa,   0xac0b,  0xfa,   0x698c,  0xfa,   0xac0b,  0xfa,   0x17d6,  0xf9,   0x6ccc,  0xfa,   
0x6d8d,  0xfa,   0xefd0,  0xf9,   0xa713,  0xf9,   0x2395,  0xf9,   0xb193,  0xf9,   0xdc99,  0xf8,   0x2e96,  0xf9,   0x7395,  0xf9,   
0xe818,  0xf8,   0xb69a,  0xf8,   0xea4c,  0xfa,   0xec12,  0xf9,   0x795e,  0xf8,   0x28cd,  0xfb,   0x274f,  0xfb,   0x2890,  0xfb,   
0x3adf,  0xf8,   0x420,  0xf8,   
},
{
0x8fe1,  0xf7,	 0xc51f,  0xf7,   0xd424,  0xf6,   0x9723,	0xf6,	
0xcfdb,  0xf8,	 0x511e,  0xf8,   0x51d9,  0xf9,   0x11a0,	0xf8,	0x92d9,  0xf8,	 0x131d,  0xf8,   0xd698,  0xf7,   0x1598,	0xf9,	
0xd6da,  0xf8,	 0xd856,  0xf8,   0x9999,  0xf8,   0xd4a0,	0xf7,	0xd760,  0xf7,	 0xd85f,  0xf7,   0x9921,  0xf7,   0x579e,	0xf8,	
0x1860,  0xf8,	 0x19dd,  0xf8,   0xdb60,  0xf7,   0x8c6b,	0xf7,	0x4eab,  0xf6,	 0x502d,  0xf6,   0x8d6b,  0xf7,   0x8eeb,	0xf7,	
0x8feb,  0xf7,	 0x50aa,  0xf7,   0x50ea,  0xf7,   0xcfaa,	0xf7,	0x906a,  0xf7,	 0x92e8,  0xf7,   0x522a,  0xf7,   0xd1aa,	0xf5,	
0x936b,  0xf5,	 0xd5a7,  0xf5,   0x172b,  0xf5,   0x9327,	0xf6,	0x12ea,  0xf7,	 0x5467,  0xf6,   0x55a8,  0xf6,   0x53a7,	0xf7,	
0x13ea,  0xf7,	 0x1668,  0xf7,   0xd3aa,  0xf6,   0x156a,	0xf6,	0x14ea,  0xf7,	 0xd6aa,  0xf6,   0x976a,  0xf6,   0x1826,	0xf6,	
0x99ea,  0xf5,	 0x9430,  0xf5,   0x9532,  0xf5,   0x18ed,	0xf5,	0x19ef,  0xf5,	 0xd76e,  0xf5,   0x5aec,  0xf5,   0x5b6e,	0xf5,	
0x56a7,  0xf7,	 0x5629,  0xf7,   0x1769,  0xf7,   0xd82a,	0xf6,	0x98e8,  0xf7,	 0x5a29,  0xf7,   0x1ae4,  0xf7,   0x19a9,	0xf7,	
0x99e9,  0xf6,	 0x1c65,  0xf6,   0x5c69,  0xf6,   0x5aa7,	0xf7,	0x1b28,  0xf7,	 0xdd68,  0xf6,   0x9da1,  0xf7,   0x5de7,	0xf7,	
0x1ce9,  0xf6,	 0x1cec,  0xf6,   0x9e28,  0xf6,   0x1d6d,	0xf6,	0x1f28,  0xf7,	 0x9fd5,  0xf7,   0xdd1f,  0xf6,   0x601a,	0xf7,	
0x9f9e,  0xf7,	 0x6299,  0xf7,   0xe29b,  0xf6,   0x9aa6,	0xf5,	0x9c68,  0xf5,	 0x1bab,  0xf4,   0x5caf,  0xf4,   0xdeeb,	0xf3,	
0x20ec,  0xf3,	 0x5dea,  0xf5,   0xde2d,  0xf4,   0x60ea,	0xf4,	0x236b,  0xf4,	 0x242b,  0xf3,   0xa5aa,  0xf3,   0x9de3,	0xf6,	
0x1e67,  0xf6,	 0xe2a5,  0xf5,   0x9fa1,  0xf7,   0x2264,	0xf7,	0xa3de,  0xf6,	 0x6424,  0xf6,   0xde69,  0xf5,   0x1eab,	0xf6,	
0xa029,  0xf5,	 0x6129,  0xf5,   0x5fa8,  0xf6,   0x1fea,	0xf6,	0x21a7,  0xf6,	 0xe268,  0xf5,   0x20eb,  0xf6,   0x63a8,	0xf5,	
0x6628,  0xf5,	 0xe027,  0xf6,   0xa1a9,  0xf6,   0x6227,	0xf6,	0x6328,  0xf6,	 0x2226,  0xf7,   0x22e6,  0xf7,   0xa467,	0xf6,	
0x23aa,  0xf6,	 0x24a5,  0xf6,   0x24e7,  0xf6,   0xe5e5,	0xf5,	0xa6e6,  0xf5,	 0xa5e4,  0xf6,   0x65e6,  0xf6,   0x2725,	0xf6,	
0x27a6,  0xf6,	 0x25a9,  0xf6,   0x25ea,  0xf6,   0x67a8,	0xf5,	0x26e8,  0xf6,	 0x27a9,  0xf6,   0xe8a7,  0xf5,   0x29a8,	0xf6,	
0xa829,  0xf4,	 0xe965,  0xf5,   0x68a8,  0xf5,   0x2e66,	0xf5,	0x8aa5,  0xf7,	 0x4da6,  0xf7,   0x10a7,  0xf7,   0x13a9,	0xf7,	
0xd6aa,  0xf6,	 0x9855,  0xf9,   0x58d9,  0xf9,   0x5bd4,	0xf9,	0x1c97,  0xf9,	 0xde52,  0xf9,   0x9f15,  0xf9,   0xdd9a,	0xf8,	
0x5e5f,  0xf8,	 0x1f21,  0xf8,   0x1f11,  0xf9,   0xdfd5,	0xf8,	0xa453,  0xf7,	 0x6151,  0xf9,   0x6254,  0xf9,   0x248f,	0xf9,	
0xa5d2,  0xf8,	 0x6058,  0xf8,   0x201e,  0xf8,   0xa496,	0xf7,	0x6619,  0xf7,	 0x2357,  0xf9,   0xa3db,  0xf8,   0xa715,	0xf8,	
0xa698,  0xf8,	 0x2a50,  0xf8,   0xad4f,  0xf7,   0x68d8,	0xf7,	0xaad2,  0xf7,	 0x240f,  0xfa,   0xe4d2,  0xf9,   0xa78c,	0xf9,	
0xa811,  0xf9,	 0x27cc,  0xfb,   0xe78f,  0xfa,   0xaa8c,	0xfa,	0x6bce,  0xfa,	 0xa555,  0xf9,   0x6993,  0xf9,   0xe997,	0xf8,	
0x2cd1,  0xfa,	 0xed0b,  0xf8,   0xac4d,  0xf8,   0xafcb,	0xf8,	0xed89,  0xf9,	 0x2e4d,  0xfa,   0x72c5,  0xf9,   0x728c,	0xf9,	
0xec52,  0xf8,	 0xec94,  0xf8,   0xef90,  0xf9,   0xb193,	0xf9,	0x730e,  0xf9,	 0x33d2,  0xf9,   0xe260,  0xf7,   0xa461,	0xf7,	
0xe6db,  0xf6,	 0xa6a1,  0xf7,   0xa3de,  0xf8,   0x2660,	0xf8,	0xe920,  0xf7,	 0xa465,  0xf7,   0xe8e5,  0xf6,   0x69a7,	0xf6,	
0xab22,  0xf7,	 0x2be4,  0xf7,   0x6b24,  0xf6,   0x2b26,	0xf6,	0xec26,  0xf5,	 0xece5,  0xf5,   0xad66,  0xf5,   0x6ca5,	0xf6,	
0x6ce6,  0xf6,	 0x6de5,  0xf6,   0x2f25,  0xf6,   0xafe5,	0xf5,	0xed61,  0xf7,	 0xafa4,  0xf6,   0x71e4,  0xf6,   0x2d1f,	0xf8,	
0x2d20,  0xf8,	 0x7315,  0xf9,   0x3418,  0xf9,   0x3496,	0xf9,	0xf5d8,  0xf8,	 0xf060,  0xf7,   0xf2e1,  0xf7,   0x34e2,	0xf7,	
0xf461,  0xf7,	 0x779b,  0xf8,   0xf7a0,  0xf7,   0x420,  0xf8,	 
}
} ;
#else
static unsigned short used_palette_common[5][480] = 
{
{
0x556b,  0xf6,   0xdfed,  0xf5,   0xc560,  0xf7,   0xa4e7,  0xf6,   0x2ae5,  0xf7,   
0x18aa,  0xf6,   0xd6ea,  0xf5,   0xd9ea,  0xf5,   0xe4eb,  0xf5,   0x60a8,  0xf6,   0x12a4,  0xf7,   0x2d24,  0xf7,   0x7223,  0xf7,   
0xa662,  0xf7,   0xd16b,  0xf5,   0xdb6a,  0xf5,   0xa726,  0xf6,   0xad27,  0xf6,   0xdcaa,  0xf5,   0x61e2,  0xf7,   0xb161,  0xf7,   
0xb261,  0xf7,   0xb521,  0xf7,   0xf8a0,  0xf7,   0x9c6a,  0xf5,   0x58ab,  0xf5,   0x9aaa,  0xf5,   0x9da9,  0xf5,   0x9f29,  0xf5,   
0x676b,  0xf5,   0xa8ea,  0xf5,   0xea69,  0xf5,   0x6a23,  0xf7,   0x9d29,  0xf5,   0x9ea9,  0xf5,   0x5fa9,  0xf5,   0x9e29,  0xf5,   
0xa9e9,  0xf5,   0x5da6,  0xf6,   0x6ce2,  0xf7,   0xb061,  0xf7,   0xa9e1,  0xf7,   0xdd60,  0xf7,   0x1eaa,  0xf5,   0x5da9,  0xf5,   
0x6069,  0xf5,   0x60e9,  0xf5,   0xa228,  0xf5,   0x5a66,  0xf6,   0xa328,  0xf5,   0xac25,  0xf6,   0xa965,  0xf6,   0xeea4,  0xf6,   
0x69e2,  0xf7,   0x6ae2,  0xf7,   0x6ba2,  0xf7,   0x6ca2,  0xf7,   0xa861,  0xf7,   0xb721,  0xf7,   0xb321,  0xf7,   0xb221,  0xf7,   
0xb3e1,  0xf7,   0x582c,  0xf4,   0x99ac,  0xf4,   0xdc2a,  0xf4,   0x5ea8,  0xf5,   0x2269,  0xf5,   0x61a9,  0xf5,   0x6269,  0xf5,   
0xa067,  0xf5,   0x2866,  0xf6,   0x6b25,  0xf6,   0x69e5,  0xf6,   0xaaa4,  0xf6,   0x25e3,  0xf7,   0x27a3,  0xf7,   0x2ce3,  0xf7,   
0xb121,  0xf7,   0xf5e0,  0xf7,   0x1c2c,  0xf4,   0x9f2a,  0xf4,   0xddaa,  0xf4,   0xe0aa,  0xf4,   0x2229,  0xf5,   0x6329,  0xf5,   
0x23e9,  0xf5,   0x24a9,  0xf5,   0x2669,  0xf5,   0xa167,  0xf5,   0xa467,  0xf5,   0xa4e4,  0xf6,   0xa064,  0xf6,   0x67a5,  0xf6,   
0x6d25,  0xf6,   0x6ea5,  0xf6,   0xe6e4,  0xf6,   0xe3a3,  0xf6,   0xe823,  0xf6,   0xeba3,  0xf6,   0xf1a3,  0xf6,   0x2b23,  0xf7,   
0x28e2,  0xf7,   0x29a2,  0xf7,   0x2aa2,  0xf7,   0x2b62,  0xf7,   0x3363,  0xf7,   0x2e62,  0xf7,   0x6e62,  0xf7,   0x6f21,  0xf7,   
0xaba1,  0xf7,   0xad61,  0xf7,   0xe1ea,  0xf4,   0xe329,  0xf4,   0xe66a,  0xf4,   0x2469,  0xf5,   0x2528,  0xf5,   0x25e8,  0xf5,   
0x6668,  0xf5,   0x2768,  0xf5,   0x6928,  0xf5,   0x69e8,  0xf5,   0x1fa5,  0xf6,   0xaa27,  0xf5,   0xa727,  0xf5,   0xa8a7,  0xf5,   
0xe5e6,  0xf5,   0x22a6,  0xf6,   0x2465,  0xf6,   0x61a5,  0xf6,   0xea26,  0xf5,   0xe766,  0xf5,   0x26a5,  0xf6,   0xe923,  0xf6,   
0x2962,  0xf7,   0x2a63,  0xf7,   0x6c62,  0xf7,   0x6d62,  0xf7,   0x7021,  0xf7,   0xb1e1,  0xf7,   0xb2e1,  0xf7,   0x26a8,  0xf5,   
0xe869,  0xf4,   0x26e8,  0xf5,   0x28a8,  0xf5,   0x2968,  0xf5,   0x6828,  0xf5,   0x68e8,  0xf5,   0x2a68,  0xf5,   0x69a8,  0xf5,   
0x6aa8,  0xf5,   0x69e7,  0xf5,   0xd663,  0xf6,   0x6aa7,  0xf5,   0x6ba7,  0xf5,   0xab27,  0xf5,   0xabe6,  0xf5,   0xec66,  0xf5,   
0xeda6,  0xf5,   0x2ee5,  0xf6,   0x7024,  0xf6,   0x9e2c,  0xf3,   0xea68,  0xf4,   0x2928,  0xf5,   0x29e8,  0xf5,   0x2867,  0xf5,   
0x2967,  0xf5,   0x2ae8,  0xf5,   0x68a7,  0xf5,   0x2a27,  0xf5,   0x2b27,  0xf5,   0x69a7,  0xf5,   0x6a67,  0xf5,   0x6b67,  0xf5,   
0x6aa7,  0xf5,   0x6b67,  0xf5,   0x6c67,  0xf5,   0xaca7,  0xf5,   0xace6,  0xf5,   0x7164,  0xf6,   0x2a62,  0xf7,   0x2b62,  0xf7,   
0x2c22,  0xf7,   0x2d22,  0xf7,   0xe22a,  0xf3,   0x2aa7,  0xf5,   0x2ba7,  0xf5,   0x2ae7,  0xf5,   0x6a67,  0xf5,   0x6be7,  0xf5,   
0x6b27,  0xf5,   0x6ce6,  0xf5,   0x6c26,  0xf5,   0xad66,  0xf5,   0x21eb,  0xf3,   0xb4a0,  0xf7,   0xed27,  0xf4,   0xb2a1,  0xf7,   
0xae22,  0xf6,   0xdba5,  0xf4,   0xf223,  0xf5,   0x9e63,  0xf5,   0x6264,  0xf4,   0x21a3,  0xf5,   0x6a25,  0xf3,   0xa823,  0xf4,   
0x75a1,  0xf6,   0x7521,  0xf6,   0xece3,  0xf3,   0xe9a2,  0xf4,   0xef63,  0xf3,   0x6822,  0xf5,   0x70e2,  0xf4,   0xee21,  0xf4,   
0xf31f,  0xf6,   0xd81f,  0xf7,   0xe35f,  0xf7,   0x36df,  0xf8,   0x7347,  0xf9,   0xb108,  0xf9,   0xab8b,  0xf9,   0x6410,  0xf9,   
0x2ec9,  0xfa,   0xe88d,  0xf9,   0x2694,  0xf9,   0x6cd3,  0xf9,   0xd617,  0xf8,   0x34d6,  0xf9,   0xac4a,  0xfa,   0x2e8d,  0xfa,   
0xb699,  0xf8,   0x7293,  0xf9,   0xee99,  0xf8,   0x275f,  0xf8,   0x33df,  0xf8,   0x2fdf,  0xf8,   0x2e1f,  0xf8,   0x329f,  0xf8,   
0x351f,  0xf8,   0x3a9f,  0xf8,   0xf19f,  0xf7,    	
}
,
{
0x55f,  0xf8,   0x321f,  0xf8,   0x5560,  0xf8,   0x5360,  0xf8,   
0x18a0,  0xf8,   0x30a0,  0xf8,   0x3920,  0xf8,   0x3760,  0xf8,   0x4de1,  0xf8,   0x11a1,  0xf8,   0x7a1,  0xf8,   0xaa1,  0xf8,   
0x5a2,  0xf8,   0x1ee1,  0xf8,   0x3262,  0xf8,   0xca6b,  0xf7,   0xd22d,  0xf7,   0xf3e1,  0xf7,   0xcfa3,  0xf7,   0x56ad,  0xf7,   
0xc521,  0xf7,   0xc921,  0xf7,   0xd461,  0xf7,   0xcf60,  0xf7,   0xe421,  0xf7,   0xd0e0,  0xf7,   0xf6a1,  0xf7,   0xf1a0,  0xf7,   
0xf8a0,  0xf7,   0xeaa0,  0xf7,   0xe760,  0xf7,   0xf360,  0xf7,   0xe5a0,  0xf7,   0x512a,  0xf7,   0x96e8,  0xf7,   0x9a27,  0xf7,   
0x53a9,  0xf7,   0xd2e1,  0xf7,   0x9fe6,  0xf7,   0xcd21,  0xf7,   0xa764,  0xf7,   0xc6e2,  0xf7,   0xade3,  0xf7,   0xefe1,  0xf7,   
0xdc2b,  0xf6,   0x5ce7,  0xf7,   0xa4a5,  0xf7,   0xf520,  0xf7,   0xaa64,  0xf7,   0xd929,  0xf6,   0xd66a,  0xf6,   0x21a8,  0xf7,   
0xd430,  0xf5,   0xdb21,  0xf7,   0xec60,  0xf7,   0x93b1,  0xf5,   0x95f2,  0xf5,   0xd3b0,  0xf5,   0xd96e,  0xf5,   0xeee0,  0xf7,   
0xfac,  0xf6,   0x9570,  0xf5,   0x1dec,  0xf6,   0x9ee8,  0xf6,   0x5530,  0xf5,   0x57b0,  0xf5,   0x972f,  0xf5,   0x5ba9,  0xf6,   
0x216b,  0xf6,   0xa3e7,  0xf6,   0x58ef,  0xf5,   0x19aa,  0xf6,   0xe766,  0xf6,   0x7163,  0xf7,   0xa1e1,  0xf7,   0x1aee,  0xf5,   
0x9e61,  0xf7,   0xe8e0,  0xf7,   0x926b,  0xf5,   0x1ced,  0xf5,   0x2469,  0xf6,   0x6128,  0xf6,   0x1be3,  0xf7,   0x2c64,  0xf7,   
0x9ca1,  0xf7,   0xa521,  0xf7,   0x4862,  0xf7,   0x6627,  0xf6,   0x95a1,  0xf7,   0x9921,  0xf7,   0xa361,  0xf7,   0xa6e1,  0xf7,   
0xb2e1,  0xf7,   0x14eb,  0xf5,   0x572b,  0xf5,   0xdea9,  0xf5,   0xa9a6,  0xf6,   0x9761,  0xf7,   0x9fe1,  0xf7,   0xdead,  0xf4,   
0xe328,  0xf5,   0xd764,  0xf6,   0x2f24,  0xf7,   0xd6ab,  0xf4,   0xcb64,  0xf6,   0x196b,  0xf5,   0x6029,  0xf5,   0xa169,  0xf5,   
0xe827,  0xf5,   0xd067,  0xf5,   0x8de5,  0xf6,   0x982c,  0xf4,   0x9265,  0xf6,   0x62e9,  0xf5,   0x2b26,  0xf6,   0xdeaa,  0xf4,   
0x5c29,  0xf5,   0xe12a,  0xf4,   0xa4e8,  0xf5,   0x2d66,  0xf6,   0x54a8,  0xf5,   0x5bab,  0xf4,   0x63ab,  0xf4,   0xc620,  0xf7,   
0xe3a9,  0xf4,   0x27a8,  0xf5,   0x9061,  0xf7,   0x74a2,  0xf7,   0xe5e9,  0xf4,   0x9829,  0xf4,   0xde6b,  0xf3,   0xaa20,  0xf7,   
0xa1ab,  0xf3,   0xeb28,  0xf4,   0x8ea0,  0xf7,   0xada0,  0xf7,   0x7224,  0xf6,   0xb120,  0xf7,   0xb7e0,  0xf7,   0x652b,  0xf3,   
0x1a64,  0xf6,   0xaf65,  0xf5,   0x93e0,  0xf7,   0x87e0,  0xf7,   0x9fa2,  0xf6,   0x8b20,  0xf7,   0xf9a0,  0xf7,   0xe320,  0xf7,   
0xd721,  0xf5,   0x6221,  0xf5,   0x91e0,  0xf7,   0x94df,  0xf7,   0x1d5c,  0xf5,   0x621d,  0xf6,   0x669d,  0xf6,   0x351e,  0xf7,   
0x6257,  0xf4,   0x8e5f,  0xf7,   0xc5df,  0xf7,   0xcd5f,  0xf7,   0x6756,  0xf5,   0x5cdd,  0xf7,   0xcfdf,  0xf7,   0xaa99,  0xf6,   
0xd35e,  0xf7,   0xd91f,  0xf7,   0xf399,  0xf7,   0xaa51,  0xf7,   0xae14,  0xf7,   0xb157,  0xf7,   0x69f,  0xf8,   0x219e,  0xf8,   
0x165e,  0xf8,   0x1c9f,  0xf8,   0x315f,  0xf8,   0x39df,  0xf8,   0x129f,  0xf8,   0x1e9f,  0xf8,   0x389e,  0xf8,   0x334e,  0xf9,   
0x89e,  0xf8,   0xa258,  0xf8,   0xef4b,  0xf9,   0xb08e,  0xf9,   0x6dd1,  0xf9,   0x29d4,  0xf9,   0xf1e,  0xf8,   0x10de,  0xf8,   
0xabd0,  0xf9,   0x6553,  0xf9,   0xb0cf,  0xf9,   0x6c8b,  0xfa,   0x2e0c,  0xfa,   0xea8e,  0xf9,   0x2e8e,  0xfa,   0xa911,  0xf9,   
0x15d7,  0xf9,   0x61d4,  0xf9,   0x1a17,  0xf9,   0x68cf,  0xfa,   0x6c4d,  0xfa,   0xe5d0,  0xf9,   0xaacc,  0xfa,   0xd15a,  0xf8,   
0x6ccf,  0xfa,   0x5dd6,  0xf9,   0x294c,  0xfb,   0x8ddb,  0xf8,   0xd79b,  0xf8,   0x93dc,  0xf8,   0x4ade,  0xf8,   0x529e,  0xf8,   
0x5b9e,  0xf8,   0x355f,  0xf8,   0x471f,  0xf8,   0x629f,  0xf8,   0x581f,  0xf8,   0x60df,  0xf8,   0x4ddf,  0xf8,   0x4fde,  0xf8,   
0x305f,  0xf8,   0x38df,  0xf8,   0x371f,  0xf8,   0xbdf,  0xf8,   0x161f,  0xf8,   0x3adf,  0xf8,   0xf860,  0xf7,   0xf69f,  0xf7,   
0xf19f,  0xf7,   0xe3df,  0xf7,   0x2220,  0xf8,   0x2060,  0xf8,   0xdce0,  0xf7,   0x1a60,  0xf8,   0x17e0,  0xf8,   0x1460,  0xf8,   
0xf20,  0xf8,   0x920,  0xf8,   0x69f,  0xf8,   0xc4df,  0xf7,   
}
,
{
0x4ddf,  0xf8,   0x665f,  0xf8,   0xce0,  0xfa,   0x12a2,  0xfb,   0x5221,  0xf9,   0xd6e2,  0xf9,   
0x1020,  0xf8,   0xdb62,  0xf8,   0x14e0,  0xf8,   0x2120,  0xf8,   0x27e0,  0xf8,   0x2ee0,  0xf8,   0x29a0,  0xf8,   0x3260,  0xf8,   
0x30a0,  0xf8,   0x3adf,  0xf8,   0x2b60,  0xf8,   0x35a0,  0xf8,   0x1a20,  0xf8,   0x56a1,  0xf8,   0x9ee3,  0xf8,   0x24a1,  0xf8,   
0x2821,  0xf8,   0x2122,  0xf8,   0x1ae2,  0xf8,   0x2323,  0xf8,   0x1161,  0xf8,   0xdf22,  0xf7,   0xcf60,  0xf7,   0xd661,  0xf7,   
0xe261,  0xf7,   0xe961,  0xf7,   0xe421,  0xf7,   0xe7a1,  0xf7,   0xeca1,  0xf7,   0xe3e0,  0xf7,   0xe260,  0xf7,   0xe920,  0xf7,   
0xe760,  0xf7,   0xee60,  0xf7,   0xeae0,  0xf7,   0xf1a0,  0xf7,   0xf020,  0xf7,   0xdce0,  0xf7,   0xe5a0,  0xf7,   0xdea0,  0xf7,   
0xdb20,  0xf7,   0xe5e2,  0xf7,   0xdd62,  0xf7,   0xf521,  0xf7,   0xd9a0,  0xf7,   0xf6e1,  0xf7,   0x9beb,  0xf5,   0x94e4,  0xf7,   
0xdb62,  0xf7,   0xdee1,  0xf7,   0x8c23,  0xf7,   0xe061,  0xf7,   0xb363,  0xf7,   0xa163,  0xf7,   0x9623,  0xf7,   0x9463,  0xf7,   
0x97e3,  0xf7,   0xb27,  0xf7,   0xc9a2,  0xf7,   0x8be2,  0xf7,   0x8da2,  0xf7,   0x8f22,  0xf7,   0x90e2,  0xf7,   0x92a2,  0xf7,   
0x99e3,  0xf7,   0x9622,  0xf7,   0xcd61,  0xf7,   0x99a2,  0xf7,   0xd461,  0xf7,   0x4eac,  0xf6,   0xaba3,  0xf7,   0x136e,  0xf6,   
0x4d64,  0xf7,   0xd7a1,  0xf7,   0x1d2c,  0xf6,   0x5424,  0xf7,   0x68a4,  0xf7,   0x95e2,  0xf7,   0x9ce2,  0xf7,   0xe061,  0xf7,   
0x162c,  0xf6,   0xcee6,  0xf6,   0x92a8,  0xf6,   0x20ab,  0xf6,   0x9e68,  0xf6,   0xe568,  0xf6,   0x9b21,  0xf7,   0x9068,  0xf6,   
0x98e9,  0xf6,   0x5063,  0xf7,   0x9ee2,  0xf7,   0x7123,  0xf7,   0x19ab,  0xf6,   0x95e8,  0xf6,   0x4d23,  0xf7,   0x4ea3,  0xf7,   
0xdb26,  0xf6,   0x8ee1,  0xf7,   0xca4,  0xf7,   0xe166,  0xf6,   0xdea5,  0xf6,   0x5563,  0xf7,   0xaf61,  0xf7,   0x63a3,  0xf7,   
0xa1e1,  0xf7,   0x4ea2,  0xf7,   0x5022,  0xf7,   0x5562,  0xf7,   0x5c62,  0xf7,   0xa8a1,  0xf7,   0xcba0,  0xf7,   0x6d63,  0xf7,   
0xa6e1,  0xf7,   0xa521,  0xf7,   0x33e3,  0xf7,   0xea60,  0xf7,   0x7622,  0xf7,   0xb821,  0xf7,   0xb461,  0xf7,   0x8e61,  0xf7,   
0xde20,  0xf7,   0xe360,  0xf7,   0xa7a6,  0xf5,   0xaee4,  0xf6,   0x2ba5,  0xf6,   0x96e1,  0xf7,   0xd060,  0xf7,   0xd5a0,  0xf7,   
0x8fe0,  0xf7,   0xd760,  0xf7,   0xdaa0,  0xf7,   0xe860,  0xf7,   0xebe0,  0xf7,   0xd420,  0xf7,   0xf2a0,  0xf7,   0xf120,  0xf7,   
0xdc60,  0xf7,   0xe1a0,  0xf7,   0xf620,  0xf7,   0x59de,  0xf7,   0x925f,  0xf7,   0xce5f,  0xf7,   0x901f,  0xf7,   0xe31f,  0xf7,   
0xd71f,  0xf7,   0xab5f,  0xf7,   0xe4df,  0xf7,   0xe81f,  0xf7,   0xf29f,  0xf7,   0xf0df,  0xf7,   0xe54d,  0xf2,   0xa69e,  0xf7,   
0xd55e,  0xf7,   0xa09b,  0xf7,   0x6dc8,  0xf6,   0x9f99,  0xf7,   0xcb9e,  0xf7,   0x2d94,  0xf8,   0x5815,  0xf8,   0x6557,  0xf8,   
0x5298,  0xf8,   0x1adf,  0xf8,   0x21df,  0xf8,   0x2f9f,  0xf8,   0x331f,  0xf8,   0x3286,  0xf9,   0xb692,  0xf8,   0x268c,  0xf9,   
0xde91,  0xf8,   0xf34c,  0xf8,   0x28de,  0xf8,   0x369e,  0xf8,   0x5019,  0xf8,   0x315f,  0xf8,   0x259e,  0xf8,   0xe9e,  0xf8,   
0x10df,  0xf8,   0x2a9f,  0xf8,   0x385e,  0xf8,   0x34de,  0xf8,   0x23de,  0xf8,   0xee18,  0xf9,   0x5757,  0xfa,   0xa053,  0xfb,   
0xe491,  0xfb,   0x6793,  0xfb,   0x6197,  0xfa,   0xda19,  0xf9,   0xdc95,  0xfa,   0xd599,  0xf9,   0xd95c,  0xf8,   0xa89a,  0xf9,   
0x949d,  0xf8,   0x921a,  0xf9,   0xe5c,  0xf9,   0x705f,  0xf8,   0x6edf,  0xf8,   0x6d1f,  0xf8,   0x699f,  0xf8,   0x8a1e,  0xf8,   
0x4f9f,  0xf8,   0x609f,  0xf8,   0x73df,  0xf8,   0x371f,  0xf8,   0x621f,  0xf8,   0x6b5f,  0xf8,   0x67df,  0xf8,   0x645f,  0xf8,   
0x321f,  0xf8,   0x359f,  0xf8,   0xf860,  0xf7,   0xf69f,  0xf7,   0xf4df,  0xf7,   0x331f,  0xf8,   0xf19f,  0xf7,   0xefdf,  0xf7,   
0x2e1f,  0xf8,   0xec5f,  0xf7,   0xeaa0,  0xf7,   0xe8e0,  0xf7,   0xe720,  0xf7,   0xe3df,  0xf7,   0x2220,  0xf8,   0x2060,  0xf8,   
0x1960,  0xf8,   0x17e0,  0xf8,   0x1620,  0xf8,   0x12a0,  0xf8,   0xd0e0,  0xf7,   0xf20,  0xf8,   0xd60,  0xf8,   0xc89f,  0xf7,   
0x5a0,  0xf8,   0x4a0,  0xf8,      
}
,
{
0x30df,  0xf8,   0x6fdf,  0xf8,   0x3a20,  0xf8,   0x3920,  0xf8,   0x2d60,  0xf8,   0x31a0,  0xf8,   
0x2f60,  0xf8,   0x2ba1,  0xf8,   0x2661,  0xf8,   0x2be2,  0xf8,   0xc4e0,  0xf7,   0xf160,  0xf7,   0xe2a0,  0xf7,   0xf9e0,  0xf7,   
0xf820,  0xf7,   0xf120,  0xf7,   0xf3a0,  0xf7,   0xe961,  0xf7,   0xeb61,  0xf7,   0xeca0,  0xf7,   0xeda0,  0xf7,   0xe7e1,  0xf7,   
0xf720,  0xf7,   0x126a,  0xf7,   0x1569,  0xf7,   0x5d27,  0xf7,   0xd320,  0xf7,   0xeaa1,  0xf7,   0xe360,  0xf7,   0x1a28,  0xf7,   
0x1fa7,  0xf7,   0x62a6,  0xf7,   0xa9e4,  0xf7,   0x64e5,  0xf7,   0xa5e3,  0xf7,   0xe2a1,  0xf7,   0xcd20,  0xf7,   0xf1e1,  0xf7,   
0xf560,  0xf7,   0xeea0,  0xf7,   0xf4a0,  0xf7,   0x5aa4,  0xf7,   0xc7a0,  0xf7,   0xa423,  0xf7,   0xd020,  0xf7,   0xf620,  0xf7,   
0xa7e3,  0xf7,   0xe421,  0xf7,   0xd5a0,  0xf7,   0xed61,  0xf7,   0xe920,  0xf7,   0xe7a0,  0xf7,   0xebe0,  0xf7,   0x5824,  0xf7,   
0x5d24,  0xf7,   0x64e3,  0xf7,   0xafa2,  0xf7,   0xca60,  0xf7,   0xf2a1,  0xf7,   0xf3a1,  0xf7,   0xf020,  0xf7,   0xe420,  0xf7,   
0x572a,  0xf6,   0x5363,  0xf7,   0x5fa4,  0xf7,   0x6164,  0xf7,   0x62e4,  0xf7,   0x63e4,  0xf7,   0x65a3,  0xf7,   0x66a3,  0xf7,   
0xabe2,  0xf7,   0xace2,  0xf7,   0xdb21,  0xf7,   0xae22,  0xf7,   0xf461,  0xf7,   0xa923,  0xf7,   0xaaa2,  0xf7,   0xb1a1,  0xf7,   
0xef61,  0xf7,   0xa261,  0xf7,   0xe861,  0xf7,   0xf8e0,  0xf7,   0xf2e0,  0xf7,   0x9e5,  0xf7,   0x1a2a,  0xf6,   0x5d69,  0xf6,   
0xea61,  0xf7,   0xf0e1,  0xf7,   0xade6,  0xf6,   0xaee6,  0xf6,   0xef26,  0xf6,   0x2863,  0xf7,   0x2d23,  0xf7,   0xa8a2,  0xf7,   
0x74e3,  0xf7,   0x9f61,  0xf7,   0xe221,  0xf7,   0xe561,  0xf7,   0x156d,  0xf5,   0x9a30,  0xf4,   0x18ae,  0xf5,   0xdd2f,  0xf4,   
0x51e8,  0xf6,   0x606c,  0xf5,   0xad67,  0xf6,   0xaea6,  0xf6,   0xafa6,  0xf6,   0xefe5,  0xf6,   0x6f23,  0xf7,   0x9c21,  0xf7,   
0x75a2,  0xf7,   0x9d61,  0xf7,   0xb6a2,  0xf7,   0xa361,  0xf7,   0xa42b,  0xf5,   0xe869,  0xf5,   0x2b68,  0xf6,   0xa7a6,  0xf6,   
0xae66,  0xf6,   0xafa5,  0xf6,   0xf0a5,  0xf6,   0x31a4,  0xf7,   0x2b63,  0xf7,   0x32e4,  0xf7,   0x33e3,  0xf7,   0xe6e1,  0xf7,   
0xb861,  0xf7,   0xf1e0,  0xf7,   0xdf69,  0xf5,   0x6da7,  0xf6,   0xaf66,  0xf6,   0xe6e4,  0xf6,   0xb065,  0xf6,   0x29a3,  0xf7,   
0xb761,  0xf7,   0x6426,  0xf6,   0x66e6,  0xf6,   0xb165,  0xf6,   0x7462,  0xf7,   0xd9a0,  0xf7,   0xf520,  0xf7,   0xf360,  0xf7,   
0xa1a8,  0xf5,   0xa3a8,  0xf5,   0x21e6,  0xf6,   0x27e6,  0xf6,   0xa565,  0xf6,   0xe3e4,  0xf6,   0xe864,  0xf6,   0xee24,  0xf6,   
0x97ac,  0xf4,   0xd96b,  0xf4,   0xdaea,  0xf4,   0x1c6a,  0xf5,   0x1de9,  0xf5,   0x5f29,  0xf5,   0x6029,  0xf5,   0xe527,  0xf5,   
0x2667,  0xf6,   0x6926,  0xf6,   0x6a25,  0xf6,   0x67a5,  0xf6,   0x6b65,  0xf6,   0xac25,  0xf6,   0xace4,  0xf6,   0xefa3,  0xf6,   
0x31a3,  0xf7,   0xb5a1,  0xf7,   0x76e2,  0xf7,   0x7562,  0xf7,   0xf960,  0xf7,   0x2668,  0xf5,   0xd7e0,  0xf7,   0xf7e0,  0xf7,   
0x71e4,  0xf6,   0xea68,  0xf4,   0xf0a5,  0xf5,   0x2d26,  0xf5,   0xaf25,  0xf5,   0x5be5,  0xf5,   0xdfe4,  0xf5,   0xb920,  0xf7,   
0xfa20,  0xf7,   0xf6e0,  0xf7,   0xdca1,  0xf5,   0x6220,  0xf6,   0x5f9e,  0xf6,   0xe119,  0xf6,   0xeadd,  0xf7,   0x6498,  0xf7,   
0x6055,  0xf7,   0x420,  0xf8,   0x6f9f,  0xf8,   0x2621,  0xf8,   0xf121,  0xf7,   0xf7e0,  0xf7,   0xf0e0,  0xf7,   0xd0ad,  0xf6,   
0xdea9,  0xf6,   0xe261,  0xf7,   0xca20,  0xf7,   0x19e6,  0xf7,   0x6424,  0xf7,   0xf8a0,  0xf7,   0xf0a1,  0xf7,   0xa361,  0xf7,   
0xa6a1,  0xf7,   0x33e3,  0xf7,   0xe12b,  0xf4,   0xa6a8,  0xf5,   0x9961,  0xf7,   0x23e9,  0xf5,   0x97a0,  0xf7,   0xf7a0,  0xf7,   
0x1e1f,  0xf8,   0x20df,  0xf8,   0x789a,  0xf8,   0xb617,  0xf8,   0x149f,  0xf8,   0x2bcd,  0xfa,   0x2e8d,  0xfa,   0xb153,  0xf9,   
0x3257,  0xf9,   0x969a,  0xf8,   0xae54,  0xf9,   0xeb93,  0xf9,   0x1c59,  0xf9,   0x999b,  0xf8,   0xe2d9,  0xf8,   0x2852,  0xfa,   
0xa516,  0xf9,   0x6057,  0xf9,   0xa896,  0xf9,   0x4c9d,  0xf8,   0x9e5c,  0xf8,   0x2453,  0xfa,   0x925c,  0xf8,   0x161f,  0xf8,   
0x3adf,  0xf8,   0x1c20,  0xf8,   
}
,
{
0x51aa,  0xf7,   0x52aa,  0xf7,   0x516a,  0xf7,   0x11aa,  0xf7,   0x11aa,  0xf7,   0x54aa,  0xf7,   
0x11eb,  0xf7,   0x11ea,  0xf7,   0x122b,  0xf7,   0x122a,  0xf7,   0x16a9,  0xf7,   0xd26b,  0xf6,   0x126b,  0xf7,   0xd2eb,  0xf6,   
0xd42a,  0xf6,   0xd32b,  0xf6,   0xd8a9,  0xf6,   0x93ab,  0xf6,   0xb0a2,  0xf7,   0x93eb,  0xf6,   0x966a,  0xf6,   0xdc28,  0xf6,   
0x542b,  0xf6,   0x54ab,  0xf6,   0x54ab,  0xf6,   0x156b,  0xf6,   0x152b,  0xf6,   0x152b,  0xf6,   0xd5eb,  0xf5,   0x15ab,  0xf6,   
0x156b,  0xf6,   0x18aa,  0xf6,   0xd62b,  0xf5,   0xd62b,  0xf5,   0xd62b,  0xf5,   0xd02b,  0xf5,   0x96ab,  0xf5,   0x6028,  0xf6,   
0x91eb,  0xf5,   0x96eb,  0xf5,   0xd9ea,  0xf5,   0xa2e6,  0xf6,   0xe9a5,  0xf6,   0x6de3,  0xf7,   0xb5e1,  0xf7,   0x932b,  0xf5,   
0x57ac,  0xf5,   0x576b,  0xf5,   0x5da7,  0xf6,   0x54eb,  0xf5,   0x182c,  0xf5,   0x57ec,  0xf5,   0x95ea,  0xf5,   0x9baa,  0xf5,   
0x562a,  0xf5,   0x18ec,  0xf5,   0x572b,  0xf5,   0x18ac,  0xf5,   0x982a,  0xf5,   0x5b6b,  0xf5,   0xa6e6,  0xf6,   0xebe5,  0xf6,   
0xf860,  0xf7,   0x99ac,  0xf4,   0xd9ac,  0xf4,   0xd96c,  0xf4,   0x596a,  0xf5,   0x5d2a,  0xf5,   0xe468,  0xf5,   0x9a6c,  0xf4,   
0x9a6c,  0xf4,   0x9a2c,  0xf4,   0x9a2c,  0xf4,   0xd9ab,  0xf4,   0x1b6a,  0xf5,   0x5f6a,  0xf5,   0xae64,  0xf6,   0x5aec,  0xf4,   
0x5aac,  0xf4,   0x9d2b,  0xf4,   0xddaa,  0xf4,   0x61a9,  0xf5,   0xe667,  0xf5,   0x2966,  0xf6,   0x1bec,  0xf4,   0x5b6c,  0xf4,   
0xe22a,  0xf4,   0x2429,  0xf5,   0x6ca5,  0xf6,   0xb064,  0xf6,   0x1c6c,  0xf4,   0xdd2c,  0xf3,   0x1cac,  0xf4,   0x1cec,  0xf4,   
0xddec,  0xf3,   0x1fab,  0xf4,   0x5f2b,  0xf4,   0xa0aa,  0xf4,   0xa867,  0xf5,   0xeb66,  0xf5,   0x2de5,  0xf6,   0x6ee5,  0xf6,   
0xf3e3,  0xf6,   0xde6c,  0xf3,   0xdf2c,  0xf3,   0x626a,  0xf4,   0xa3ea,  0xf4,   0xe5a9,  0xf4,   0x2828,  0xf5,   0x2968,  0xf5,   
0xaa27,  0xf5,   0xed26,  0xf5,   0x7761,  0xf7,   0xb7a1,  0xf7,   0x5e6d,  0xf3,   0xa02c,  0xf3,   0xa0ac,  0xf3,   0xa0ec,  0xf3,   
0xa0ec,  0xf3,   0xa16c,  0xf3,   0xa12c,  0xf3,   0xa1ac,  0xf3,   0xa22b,  0xf3,   0xe22b,  0xf3,   0x23aa,  0xf4,   0x64ea,  0xf4,   
0x65ea,  0xf4,   0xa6e9,  0xf4,   0xe8e8,  0xf4,   0x2a28,  0xf5,   0x2a28,  0xf5,   0x2aa8,  0xf5,   0x2b27,  0xf5,   0x2b27,  0xf5,   
0x2b67,  0xf5,   0x2b67,  0xf5,   0x6ae7,  0xf5,   0x6be7,  0xf5,   0x6c67,  0xf5,   0x6ca7,  0xf5,   0xade6,  0xf5,   0xae26,  0xf5,   
0xae26,  0xf5,   0xeea6,  0xf5,   0x3025,  0xf6,   0x30e5,  0xf6,   0x3164,  0xf6,   0x7164,  0xf6,   0x7224,  0xf6,   0x7264,  0xf6,   
0xb323,  0xf6,   0xb363,  0xf6,   0xf4a3,  0xf6,   0xf4e2,  0xf6,   0xf4e2,  0xf6,   0x3562,  0xf7,   0x76e2,  0xf7,   0xdfed,  0xf2,   
0xa2eb,  0xf3,   0xa36b,  0xf3,   0xe3eb,  0xf3,   0xe46b,  0xf3,   0xe4ab,  0xf3,   0xe4eb,  0xf3,   0xe52b,  0xf3,   0xe56a,  0xf3,   
0xe56a,  0xf3,   0xe5ea,  0xf3,   0xe62a,  0xf3,   0xe62a,  0xf3,   0x24ea,  0xf4,   0x25aa,  0xf4,   0x26ea,  0xf4,   0x266a,  0xf4,   
0x272a,  0xf4,   0x26a9,  0xf4,   0x272a,  0xf4,   0x66e9,  0xf4,   0x6769,  0xf4,   0xa8a9,  0xf4,   0x2c27,  0xf5,   0x6c67,  0xf5,   
0x6ce6,  0xf5,   0xada6,  0xf5,   0xada6,  0xf5,   0xd8e3,  0xf6,   0xae26,  0xf5,   0x4da1,  0xf7,   0xef65,  0xf5,   0xb3e3,  0xf6,   
0x3622,  0xf7,   0xb821,  0xf7,   0xb8a1,  0xf7,   0xe66a,  0xf3,   0x26aa,  0xf4,   0x26aa,  0xf4,   0x276a,  0xf4,   0x2769,  0xf4,   
0x27a9,  0xf4,   0x27a9,  0xf4,   0xeca7,  0xf4,   0xf9e0,  0xf7,   0xfa20,  0xf7,   0xb1c5,  0xf9,   0x2f88,  0xfa,   0x2e49,  0xfa,   
0x6d89,  0xfa,   0x6a0b,  0xfa,   0xac0a,  0xfa,   0x6cca,  0xfa,   0x270d,  0xfa,   0x244e,  0xfa,   0xa190,  0xf9,   0xac8a,  0xfa,   
0x8f9b,  0xf8,   0x694c,  0xfa,   0x69cc,  0xfa,   0xac0b,  0xfa,   0x698c,  0xfa,   0xac0b,  0xfa,   0x17d6,  0xf9,   0x6ccc,  0xfa,   
0x6d8d,  0xfa,   0xefd0,  0xf9,   0xa713,  0xf9,   0x2395,  0xf9,   0xb193,  0xf9,   0xdc99,  0xf8,   0x2e96,  0xf9,   0x7395,  0xf9,   
0xe818,  0xf8,   0xb69a,  0xf8,   0xea4c,  0xfa,   0xec12,  0xf9,   0x795e,  0xf8,   0x28cd,  0xfb,   0x274f,  0xfb,   0x2890,  0xfb,   
0x3adf,  0xf8,   0x420,  0xf8,   
}
} ;

#endif
unsigned char osdsettpval(unsigned char num,unsigned char level)//from 0 -- 15
{
    SetOSD240Color(used_palette_common[num],0xff);   
    return 1;
}

void IniWinState()
{		
	AudioStatus = AUDIO_STOP ;
}


void SaveCurrentPath()
{
    char *dir_path =NULL;
    memset(PathBackUp,0,sizeof(PathBackUp));
    dir_path = FileNavGetCurrDir();
    strncpy(PathBackUp, dir_path, sizeof(PathBackUp));
}

char *GetSavedPath()
{
    return &PathBackUp[0];
}

INT32S FLupdateFileListArrowShowState(INT32S have_more_file, INT8U next_flag,INT32U start_pos)
{
	PHWND hwnd = AWFindWinCtrlByName(WinFileListBKG);
	if(!hwnd) 
		return 1;
	
	if(next_flag == 0){ // Prev
		if(have_more_file)
		{
			hwnd->draw_info[2].draw_data = (INT32U)ICON_FILELIST_UP ;
			hwnd->draw_info[3].draw_data = (INT32U)ICON_FILELIST_DOWN ;
		}
		else
		{
			hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND;
			hwnd->draw_info[3].draw_data = (INT32U)ICON_FILELIST_DOWN ;
		} 
	} 
	else if(next_flag == 1){ // Next
		if(((have_more_file) &&(start_pos==0))||((have_more_file) &&(start_pos==2)))
		{
			hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND;
			hwnd->draw_info[3].draw_data = (INT32U)ICON_FILELIST_DOWN ;
		}
		else	 if((have_more_file) &&(start_pos!=0)&&(start_pos!=2))
		{
			hwnd->draw_info[2].draw_data = (INT32U)ICON_FILELIST_UP;
			hwnd->draw_info[3].draw_data = (INT32U)ICON_FILELIST_DOWN ;
		}
		else if(((have_more_file==0) &&(start_pos==0))||((have_more_file==0) &&(start_pos==2)))
		{
			hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND;
			hwnd->draw_info[3].draw_data = (INT32U)ICON_ARROW_BACKGROUND;
		}
		else
		{
			hwnd->draw_info[2].draw_data = (INT32U)ICON_FILELIST_UP;
			hwnd->draw_info[3].draw_data = (INT32U)ICON_ARROW_BACKGROUND;
		}
	}
	
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 2);
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 3);
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0);
	
	return 0;
	
}
INT32S FLupdateFileListArrowShowState2(INT32S have_more_file, INT8U next_flag,INT32U start_pos)
{
	PHWND hwnd = AWFindWinCtrlByName(Media_FileList_BK_Panel);
	if(!hwnd) 
		return 1;
	
	if(next_flag == 0){ // Prev
		if(have_more_file){
			if(WinTypeChoice == VIDEO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_UP_VIDEO ;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_DOWN_VIDEO ;
			}
			if(WinTypeChoice == AUDIO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_FILELIST_UP ;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_FILELIST_DOWN ;
			}
		}
		else{
			if(WinTypeChoice == VIDEO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND_UP;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_DOWN_VIDEO ;
			}
			if(WinTypeChoice == AUDIO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_FILELIST_DOWN ;
			}
		} 
	} 
	else if(next_flag == 1){ // Next
		if(((have_more_file) &&(start_pos==0))||((have_more_file) &&(start_pos==2))){
			if(WinTypeChoice == VIDEO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND_UP;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_DOWN_VIDEO ;
			}
			if(WinTypeChoice == AUDIO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_FILELIST_DOWN ;
			}
		}
		else	 if((have_more_file) &&(start_pos!=0)&&(start_pos!=2)){
			if(WinTypeChoice == VIDEO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_UP_VIDEO;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_DOWN_VIDEO ;
			}
			if(WinTypeChoice == AUDIO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_FILELIST_UP;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_FILELIST_DOWN ;
			}
		}
		else if(((have_more_file==0) &&(start_pos==0))||((have_more_file==0) &&(start_pos==2))){
			if(WinTypeChoice == VIDEO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND_UP;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND_DOWN;
			}
			if(WinTypeChoice == AUDIO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND;
			}
		}
		else{
			if(WinTypeChoice == VIDEO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_UP_VIDEO;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND_DOWN;
			}
			if(WinTypeChoice == AUDIO)
			{
				hwnd->draw_info[1].draw_data = (INT32U)ICON_FILELIST_UP;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND;
			}
		}

	}
	
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 1);
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 2);
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0);
	
	return 0;
	
}

INT32S CopyDelupdateFileListArrowShowState(INT32S have_more_file, INT8U next_flag,INT32U start_pos)
{
	PHWND hwnd = AWFindWinCtrlByName(WinFileListCopyDelBKG);
	if(!hwnd) 
		return 1;

	if(next_flag == 0){ // Prev
		if(have_more_file)
		{
			hwnd->draw_info[19].draw_data = (INT32U)ICON_ARROW_UP ;
			hwnd->draw_info[20].draw_data = (INT32U)ICON_ARROW_DOWN ;
		}
		else
		{
			hwnd->draw_info[19].draw_data = (INT32U)ICON_ARROW_CDBKG ;
			hwnd->draw_info[20].draw_data = (INT32U)ICON_ARROW_DOWN ;
		} 
	} 
	else if(next_flag == 1){ // Next
		if(((have_more_file) &&(start_pos==0))||((have_more_file) &&(start_pos==2)))
		{
			hwnd->draw_info[19].draw_data = (INT32U)ICON_ARROW_CDBKG;
			hwnd->draw_info[20].draw_data = (INT32U)ICON_ARROW_DOWN ;
		}
		else	 if((have_more_file) &&(start_pos!=0)&&(start_pos!=2))
		{
			hwnd->draw_info[19].draw_data = (INT32U)ICON_ARROW_UP;
			hwnd->draw_info[20].draw_data = (INT32U)ICON_ARROW_DOWN ;
		}
		else if(((have_more_file==0) &&(start_pos==0))||((have_more_file==0) &&(start_pos==2)))
		{
			hwnd->draw_info[19].draw_data = (INT32U)ICON_ARROW_CDBKG;
			hwnd->draw_info[20].draw_data = (INT32U)ICON_ARROW_CDBKG;
		}
		else
		{
			hwnd->draw_info[19].draw_data = (INT32U)ICON_ARROW_UP;
			hwnd->draw_info[20].draw_data = (INT32U)ICON_ARROW_CDBKG;
		}
	}
	
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 19);
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 20);
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0);
	
	return 0;
	
}


void updateVolumeState(unsigned char Volume)
{
	PHWND hwnd = AWFindWinCtrlByName(Sound_Volume_Panel);
	if(hwnd){
		if(((Volume>0)||(Volume==0))&&(Volume<8)){
			switch(Volume){
				case 0:
					hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME0 ;
					break;
									
				case 1:
					hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME1 ;
					break;
					
				case 2:
					hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME2 ;
					break;
					
				case 3:
					hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME3 ;
					break;
					
				case 4:
					hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME4 ;
					break;
					
				case 5:
					hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME5 ;
					break;
					
				case 6:
					hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME6 ;
					break;
					
				case 7:
					hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME7 ;
					break;
					
				default:
					break;							
						
			} // end switch
		
		} // end if
		
		hwnd->draw_info[0].draw_data = (INT32U)ICON_SPEAKER ;
		
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 0);
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 1);
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0) ;
	} // end if	
}

void WhichWindowChoiceGetIn(unsigned int choice)
{
		PHWND dir_hwnd; 
		UpdateIsProcessBarOnShowValue();
		iniFileInfoShow();
	
		switch(choice){	
			case AUDIO :
				
				IniWinState();
				gPlayerAppShowAudioID3Info();
				gGetFileType = AW_AUDIO_LIST|NAV_IS_DIR;
				
// Media_FileList_BK_Panel
				dir_hwnd = AWFindWinCtrlByName(Media_FileList_BK_Panel);
    			if(dir_hwnd)
			{
    				dir_hwnd->draw_info[0].draw_data = (INT32U)0 ;
    				dir_hwnd->draw_info[3].draw_data = (INT32U)0 ;
    				dir_hwnd->draw_info[4].draw_data = (INT32U)0 ;
    				dir_hwnd->draw_info[5].draw_data = (INT32U)0 ;
    				dir_hwnd->draw_info[6].draw_data = (INT32U)0 ;    				
    				dir_hwnd->draw_info[7].draw_data = (INT32U)ICON_FILELIST_MUSIC_BACKGROUND ;
			}
				
// MediaTop
				dir_hwnd = AWFindWinCtrlByName(MediaTop) ;
    			if(dir_hwnd)
    				dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_MUSIC_TOP;
    				
// Video_FileInfo_Panel
				dir_hwnd = AWFindWinCtrlByName(Video_FileInfo_Panel) ;
				if(dir_hwnd) 
					if(AWIsVisibleWinControl(dir_hwnd))
						AWHideWinControl(dir_hwnd);
						
// Music_FileInfo_Panel
    			dir_hwnd = AWFindWinCtrlByName(Music_FileInfo_Panel) ;
    			if(dir_hwnd)
    				AWShowWinControl(dir_hwnd,0);
    				
// Music_Spectrum_Panel
    			dir_hwnd = AWFindWinCtrlByName(Music_Spectrum_Panel) ;
    			if(dir_hwnd)
			{
    				for(int i=1;i<16;i++)
				{
    					dir_hwnd->draw_info[i].draw_data = (INT32U)	0 ;
    				}	
    				AWShowWinControl(dir_hwnd,0);
    			}	

// Music_ProcessBar_Panel
    			dir_hwnd = AWFindWinCtrlByName(Music_ProcessBar_Panel) ;
    			if(dir_hwnd)
			{
    				mediabox_time_str[0] = 0 ;
    				dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_MUSIC_PLAY_BAR_BK ;
    				dir_hwnd->draw_info[1].draw_data = (INT32U)0 ;
    				dir_hwnd->draw_info[2].draw_data = (INT32U)0 ;
    				dir_hwnd->draw_info[3].draw_data = (INT32U)0 ;
    				dir_hwnd->draw_info[4].draw_data = (INT32U)0 ;
					AWShowWinControl(dir_hwnd,0);    					    				
    			}
    				

// Sound_Volume_Panel
				dir_hwnd = AWFindWinCtrlByName(Sound_Volume_Panel);
				if(dir_hwnd)
					AWShowWinControl(dir_hwnd,0);
				if(isMute == UNMUTE) 
				{
					dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_VOLUME_BLANK;
					dir_hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME_SPACE;	
				}
				else
				{ 
					dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_VOLUME_MUTE;
					dir_hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME_SPACE;
				}
				
// Video_PreviewScreen_Screen
				dir_hwnd = AWFindWinCtrlByName(Video_PreviewScreen_Screen);
				if(dir_hwnd)
					if(AWIsVisibleWinControl(dir_hwnd))
						AWHideWinControl(dir_hwnd);
						
				break;
				
// ----------------------------
			case VIDEO :
				showlogowait = 0;
				gGetFileType = AW_VIDEO_LIST|NAV_IS_DIR;
				
// Media_FileList_BK_Panel
				dir_hwnd = AWFindWinCtrlByName(Media_FileList_BK_Panel) ;
    			if(dir_hwnd)
			{
    				dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_PHOTO_BACKGROUND ;
    				dir_hwnd->draw_info[3].draw_data = (INT32U)0 ;
    				dir_hwnd->draw_info[4].draw_data = (INT32U)0 ;
    				dir_hwnd->draw_info[7].draw_data = (INT32U)0 ;
    				
					switch(CurrentOsdSize)
					{
						case OsdSize576i:
						case OsdSize576p:
						case OsdSize576iCVBS:
			    				dir_hwnd->draw_info[5].draw_data = (INT32U)ICON_TOP_BOTTOM_BACKGROUND1 ;
			    				dir_hwnd->draw_info[6].draw_data = (INT32U)ICON_TOP_BOTTOM_BACKGROUND2 ;
			    				break;

					    	case OsdSize720p:
			    				dir_hwnd->draw_info[5].draw_data = (INT32U)0 ;
			    				dir_hwnd->draw_info[6].draw_data = (INT32U)0 ;
			    				break;
					}
				    	
    				
			}
				
// MediaTop
				dir_hwnd = AWFindWinCtrlByName(MediaTop) ;
    			if(dir_hwnd)
    				dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_MOVIE_TOP;

// Music_FileInfo_Panel
				dir_hwnd = AWFindWinCtrlByName(Music_FileInfo_Panel) ;
				if(dir_hwnd) 
					if(AWIsVisibleWinControl(dir_hwnd))
						AWHideWinControl(dir_hwnd);
							
// Video_FileInfo_Panel
    			dir_hwnd = AWFindWinCtrlByName(Video_FileInfo_Panel) ;
    			if(dir_hwnd)
    				AWShowWinControl(dir_hwnd,0);

// Music_Spectrum_Panel
				dir_hwnd = AWFindWinCtrlByName(Music_Spectrum_Panel) ;
				if(dir_hwnd) 
					if(AWIsVisibleWinControl(dir_hwnd))
						AWHideWinControl(dir_hwnd);

// Music_ProcessBar_Panel
    			dir_hwnd = AWFindWinCtrlByName(Music_ProcessBar_Panel) ;
    			if(dir_hwnd)							
					if(AWIsVisibleWinControl(dir_hwnd))    				
						AWHideWinControl(dir_hwnd);

// Sound_Volume_Panel
				dir_hwnd = AWFindWinCtrlByName(Sound_Volume_Panel);
				if(dir_hwnd)
					if(AWIsVisibleWinControl(dir_hwnd))
						AWHideWinControl(dir_hwnd);
						
// Video_PreviewScreen_Screen
				dir_hwnd = AWFindWinCtrlByName(Video_PreviewScreen_Screen);
				if(dir_hwnd)
					AWShowWinControl(dir_hwnd,0);
					
				break;	

			default :
				break;	
		}				
}

void ClearFileMaskFlag()
{
    FileMaskFlag = 0;
    gGetFileType = 0;
    
}

void FileListInitData()
{
	FileListOnShowFlag = 0 ;
//	if (keep_current_index == 0)
//		CurrFocusIndex = 0 ;
}

INT32S SetGetFileType(INT32U type)
{
    gGetFileType = type ;
    return 0 ;
}

void FileListSetName(char *listname, char *filename, int nodir_flag)
{
    INT32S word_width = FILELIST_WIDE ;//,font_height, word_len, str_len ;
    char *lable ;
    
    if(strcmp("/mnt/", FileNavGetCurrDir()) == 0) {
        strcpy(listname, "/mnt/") ;
        listname[5] = filename[0] ;
        listname[6] = 0 ;
        lable = FileNavGetLabel(listname);
        listname[0] = filename[0] ;
        listname[1] = ':' ;
        strncpy(&listname[2], lable, SHOW_FILE_NAME_LENGTH-1-2) ;
    }
    else {

    	memset(listname, 0, SHOW_FILE_NAME_LENGTH - 1);

    	StringCopyByLen(listname, filename, Filelist_Bar_Str_len, nodir_flag);
/*
    	// 8.3  = 12 
    	if(strlen(filename)>12){
    		memset(listname,0,14);
    		strncpy(listname, filename, 8);
    		strcat(listname," ~");
    		strcat(listname, strrchr(filename, '.'));
    	}
    	else
    		strncpy(listname, filename, SHOW_FILE_NAME_LENGTH-1) ;
*/    		
    }
/*
    listname[SHOW_FILE_NAME_LENGTH-1] = 0 ;
    str_len = AWGetTextSize(listname, 0,&word_width,&font_height,&word_len, AWTF_ASCII) ;
    if((SHOW_FILE_NAME_LENGTH-1) > str_len) {
        listname[str_len] = 0 ;
    }
*/
}


INT32U GetCurIndex(void)
{
	return cur_level_index;
}

int ProcessFileIndex(INT32S process_flag,INT8U list_level)   //o for sub  1 for add
{
	int index=-1;
	switch(process_flag){
		case UOP_UP:
			if(cur_level_index>0){
				cur_level_index--;
			}
			index = cur_level_index;
			break;
		case UOP_DOWN:
			if(cur_level_index<(curDirTotalItem-1)){
				cur_level_index++;
			}
			index = cur_level_index;
			break;
	}
	return index;
}

INT32S long2short(char *long_name){
    int broken_point;	

    broken_point = strlen(long_name) -1;    	
    while (long_name[broken_point] != '/' ){
        broken_point--;
        if (broken_point <= 0)
            return -1;			
    }
    return broken_point;       	
}

void InitFileIndex(void)
{
	cur_level_index =0;
}

int GetMediaInfo(CHARSTR * filename)
{
	return 0;
}

INT32S GetFileListCB_OnlyDir(INT32S start_pos, INT8U get_num, TFILELISTITEM *entry_lists, INT8U next_flag)
{
    INT32S have_more_file = 1 ;
    INT32U get_list_num = 1;
    INT8U list_index = 0 , nodir_flag ;
    PATHNODE file_list;
    char *file_name_addr ;
    char *path;
    char cur_path[100];

    
    avfs_filesystem_options_t readorwriteopt;
    FileNavSeek(start_pos) ;
    while((list_index < get_num)&&(have_more_file)){
        if(next_flag)
            have_more_file = FileNavGetNextFileList(&file_list, &get_list_num, NAV_IS_DIR ) ;
        else
            have_more_file = FileNavGetPrevFileList(&file_list, &get_list_num, NAV_IS_DIR ) ;
		
	     path = FileNavGetCurrDir();
	     memset(cur_path,0,sizeof(cur_path));
	     
	     snprintf(cur_path,sizeof(cur_path),"%s",path);
	     strcat(cur_path,file_list.short_name);
	     
	     FileNavGetFileSystemInfo(cur_path,&readorwriteopt,NULL,NULL);
	     if(readorwriteopt==0)
		continue;
		 
        if(get_list_num){
            if(file_list.path_type & NAV_IS_DIR){ entry_lists[list_index].filelist_item_status |= (ITEM_IS_DIRECTORY |ITEM_HAVE_DATA) ;
               
                entry_lists[list_index].filelist_item_bmp = (INT32U)0;//ICON_FOLDER_2 ;//(INT32U)Folder0 ;
            }
            else{
                if(file_list.path_type & AW_AUDIO_LIST)
			entry_lists[list_index].filelist_item_bmp = (INT32U)0;//ICON_MUSIC_2 ;//(INT32U)Song0 ;
                else if(file_list.path_type & (MEDIA_PIC))
			entry_lists[list_index].filelist_item_bmp = (INT32U)0;//ICON_PHOTO_2 ;//(INT32U)Pictur0 ;
                else if(file_list.path_type & AW_VIDEO_LIST)
			entry_lists[list_index].filelist_item_bmp = (INT32U)0;//ICON_MOVIE_2 ;//(INT32U)Pictur0 ;
                else
			entry_lists[list_index].filelist_item_bmp = (INT32U)0 ;
			entry_lists[list_index].filelist_item_status &= ~ITEM_IS_DIRECTORY ;
			entry_lists[list_index].filelist_item_status |= ITEM_HAVE_DATA ;
            }
            entry_lists[list_index].filelist_item_bmp_type = DT_RLE_BMP_DATA ;
            entry_lists[list_index].filelist_item_title_type = DT_STRING_DATA ;
            entry_lists[list_index].filelist_item_id = file_list.index ; 
            entry_lists[list_index].filelist_item_context = (void *)file_list.path_type ; 
            file_name_addr = (char *)entry_lists[list_index].filelist_item_title ;
            
            nodir_flag = entry_lists[list_index].filelist_item_status & (ITEM_IS_DIRECTORY) ;
	
            FileListSetName(file_name_addr, file_list.short_name, nodir_flag) ;
            list_index++ ;
        }
    }
    while(list_index < get_num){
         entry_lists[list_index++].filelist_item_status &= ~ITEM_HAVE_DATA ;
    }
    
    if(have_more_file){ /* Though "have more file", we need check if there is more file that has gGetFileType */
            get_list_num=1;
        if(next_flag)
            FileNavGetNextFileList(&file_list, &get_list_num, NAV_IS_DIR ) ;
        else
            FileNavGetPrevFileList(&file_list, &get_list_num, NAV_IS_DIR ) ;
            if(get_list_num==0)
                have_more_file=0;
    }    
    CopyDelupdateFileListArrowShowState(have_more_file,next_flag,start_pos);
    return have_more_file ;
}


INT32S CDRootDir_OnlyDir(INT8U list_num, TFILELISTITEM *entry_lists)
{
    if(list_num > COPYLISTNUMBER+2)
        return -1;
    for(int i=0; i < list_num; i++){
        entry_lists[i].filelist_item_title = (INT32U)copyFileList[i] ;
    }
#ifdef FILE_SORTING
    if(WinTypeChoice != PHOTO)
        FileNavSetDefaultSortType(FILENAV_SORT_TYPE, FILENAV_SORT_NUM);
    else 
        FileNavSetDefaultSortType(FILENAV_SORT_NONE, FILENAV_SORT_NUM);
#endif
    return FileNavCD("/mnt") ;
}


INT32S FileNavGetNextFileList_NoDir(PATHNODE *pDesList, int *current_offset, int flag)
{
    int len = 0;
    int total_count_tmp = 0;
    char **filelist_tmp = NULL;
	
    if (NODIR_FLAG == 1) {
        total_count_tmp = total_count_music;
        pDesList->path_type = MEDIA_MP3;		
        filelist_tmp = (char **)filelist_music;  		
    }
    else if (NODIR_FLAG == 2){
        total_count_tmp = total_count_video;
        filelist_tmp = (char **)filelist_video;  		
        pDesList->path_type = AW_VIDEO_LIST;		
    }
    else {
        return 0; 
    }	
		
    if (flag == 0){
        if  ((*current_offset + 1) < total_count_tmp){
            (*current_offset)++;
            pDesList->index = *current_offset;
            len = long2short((char *)filelist_tmp[*current_offset]);	
            if (len == -1) {
                return -1;
            }
            strncpy((char *)pDesList->short_name, &((char *)filelist_tmp[*current_offset])[len+1], SHORT_NAME_LENGTH);
            pDesList->short_name[SHORT_NAME_LENGTH] = '\0';
            return 1;    
        }	
        else {
            return 0;
        }	
    }
    else {
        if  ((cur_level_index + 1) < total_count_tmp){
            pDesList->index = cur_level_index + 1;        
            len = long2short((char *)filelist_tmp[cur_level_index + 1]);	
            if (len == -1) {
                return -1;
            }			
            strncpy((char *)pDesList->short_name, &((char *)filelist_tmp[cur_level_index + 1])[len+1], SHORT_NAME_LENGTH);
            pDesList->short_name[SHORT_NAME_LENGTH] = '\0';
            return 1;    
        }
        else {
            return 0;
        }		
    }	
}

INT32S FileNavGetPrevFileList_NoDir(PATHNODE *pDesList, int *current_offset, int flag)
{
    int len = 0;
    int total_count_tmp = 0;
    char **filelist_tmp = NULL;
	
    if (NODIR_FLAG == 1) {
        total_count_tmp = total_count_music;
        pDesList->path_type = MEDIA_MP3;		
        filelist_tmp = (char **)filelist_music;  		
    }
    else if (NODIR_FLAG == 2){
        total_count_tmp = total_count_video;
        filelist_tmp = (char **)filelist_video;  		
        pDesList->path_type = AW_VIDEO_LIST;		
    }
    else {
        return 0; 
    }		
	
    if (flag == 0){
        if  (*current_offset >= 0){
            (*current_offset)--;
            pDesList->index = *current_offset;
            len = long2short((char *)filelist_tmp[*current_offset]);	
            if (len == -1) {
                return -1;
            }
            strncpy((char *)pDesList->short_name, &((char *)filelist_tmp[*current_offset])[len+1], SHORT_NAME_LENGTH);
            pDesList->short_name[SHORT_NAME_LENGTH] = '\0';
            return 1;
        }	
        else {
            return 0;
        }	
    }
    else {
        if  (cur_level_index >= 0){
            pDesList->index = cur_level_index - 1;
            len = long2short((char *)filelist_tmp[cur_level_index-1]);	
            if (len == -1) {
                return -1;
            }			
            strncpy((char *)pDesList->short_name, &((char *)filelist_tmp[cur_level_index-1])[len+1], SHORT_NAME_LENGTH);
            pDesList->short_name[SHORT_NAME_LENGTH] = '\0';
            return 1;    
        } 
        else {
            return 0;
        }			 	
    }	
}

INT32S GetFileListCB_nodir(INT32S start_pos, INT8U get_num, TFILELISTITEM *entry_lists, INT8U next_flag)
{
    INT32S have_more_file = 1 ;
    INT32U get_list_num = 1;
    INT8U list_index = 0 ;
    PATHNODE file_list;
    TFILELIST *pList = (TFILELIST *)AWFindWinCtrlByName(FileListView) ;
    char *file_name_addr ;
    int c_offset = -1 + start_pos;
    int offset_flag = 0;

    FileNavSeek(start_pos) ;
    while((list_index < get_num)&&(have_more_file)){
        if  (get_num == 1){
            offset_flag = 1;
        }
        else {
            offset_flag = 0;
        }		
        if(next_flag)
            have_more_file = FileNavGetNextFileList_NoDir(&file_list, &c_offset, offset_flag);
        else
            have_more_file = FileNavGetPrevFileList_NoDir(&file_list, &c_offset, offset_flag);
		
        if(have_more_file){

			if(file_list.path_type & NAV_IS_DIR){
                entry_lists[list_index].filelist_item_status |= (ITEM_IS_DIRECTORY |ITEM_HAVE_DATA) ;
			if(pList->list_levels == 0)
				entry_lists[list_index].filelist_item_bmp = (INT32U)0 ;//(INT32U)Folder0 ;
            }
            else{

                if(file_list.path_type & AW_AUDIO_LIST)
                    entry_lists[list_index].filelist_item_bmp = (INT32U)ICON_MUSIC_2 ;//(INT32U)Song0 ;
                else if(file_list.path_type & (MEDIA_PIC))
                    entry_lists[list_index].filelist_item_bmp = (INT32U)ICON_PHOTO_2 ;//(INT32U)Pictur0 ;
                else if(file_list.path_type & AW_VIDEO_LIST)
                    entry_lists[list_index].filelist_item_bmp = (INT32U)ICON_MOVIE_2 ;//(INT32U)Pictur0 ;
                else
                    entry_lists[list_index].filelist_item_bmp = (INT32U)0 ;

                entry_lists[list_index].filelist_item_status &= ~ITEM_IS_DIRECTORY ;
                entry_lists[list_index].filelist_item_status |= ITEM_HAVE_DATA ;
            }
            entry_lists[list_index].filelist_item_bmp_type = DT_RLE_BMP_DATA ;
            entry_lists[list_index].filelist_item_title_type = DT_STRING_DATA ;
            entry_lists[list_index].filelist_item_id = file_list.index ; 
            entry_lists[list_index].filelist_item_context = (void *)file_list.path_type ; 
            file_name_addr = (char *)entry_lists[list_index].filelist_item_title ;
            FileListSetName(file_name_addr, file_list.short_name, 0) ;
            list_index++ ;
        }
    }
    FileListViewCheck_nodir((PHWND)pList);
    while(list_index < get_num){
         entry_lists[list_index++].filelist_item_status &= ~ITEM_HAVE_DATA ;
    }
    
    if(have_more_file){ /* Though "have more file", we need check if there is more file that has gGetFileType */           
        if (get_num > 1) {
            if(next_flag)
                FileNavGetNextFileList_NoDir(&file_list, &c_offset, 0);
            else
                FileNavGetPrevFileList_NoDir(&file_list, &c_offset, 0);
        }
    }        
    updateFileListArrowShowState2(have_more_file,next_flag,cur_level_index,curDirTotalItem,7);
    
    return have_more_file ;
}


INT32S GetFileListCB(INT32S start_pos, INT8U get_num, TFILELISTITEM *entry_lists, INT8U next_flag)
{
    INT32S have_more_file = 1 ;
    INT32U get_list_num = 1;
    INT8U list_index = 0 ,dir_flag ;
    PATHNODE file_list;
    char *file_name_addr ;
    FileNavSeek(start_pos) ;
    while((list_index < get_num)&&(have_more_file)){
        if(next_flag)
            have_more_file = FileNavGetNextFileList(&file_list, &get_list_num, gGetFileType ) ;
        else
            have_more_file = FileNavGetPrevFileList(&file_list, &get_list_num, gGetFileType ) ;
        if(get_list_num){
            if(file_list.path_type & NAV_IS_DIR){
                entry_lists[list_index].filelist_item_status |= (ITEM_IS_DIRECTORY |ITEM_HAVE_DATA) ;
                entry_lists[list_index].filelist_item_bmp = (INT32U)ICON_FOLDER_2 ;//(INT32U)Folder0 ;
            }
            else{
                if(file_list.path_type & AW_AUDIO_LIST)
                    entry_lists[list_index].filelist_item_bmp = (INT32U)ICON_MUSIC_2 ;//(INT32U)Song0 ;
                else if(file_list.path_type & (MEDIA_PIC))
                    entry_lists[list_index].filelist_item_bmp = (INT32U)ICON_PHOTO_2 ;//(INT32U)Pictur0 ;
                else if(file_list.path_type & AW_VIDEO_LIST)
                    entry_lists[list_index].filelist_item_bmp = (INT32U)ICON_MOVIE_2 ;//(INT32U)Pictur0 ;
                else
                    entry_lists[list_index].filelist_item_bmp = (INT32U)0 ;
                entry_lists[list_index].filelist_item_status &= ~ITEM_IS_DIRECTORY ;
                entry_lists[list_index].filelist_item_status |= ITEM_HAVE_DATA ;
            }
            entry_lists[list_index].filelist_item_bmp_type = DT_RLE_BMP_DATA ;
            entry_lists[list_index].filelist_item_title_type = DT_STRING_DATA ;
            entry_lists[list_index].filelist_item_id = file_list.index ; 
            entry_lists[list_index].filelist_item_context = (void *)file_list.path_type ; 
            file_name_addr = (char *)entry_lists[list_index].filelist_item_title ;
            
            dir_flag = entry_lists[list_index].filelist_item_status & (ITEM_IS_DIRECTORY) ;
            FileListSetName(file_name_addr, file_list.short_name, dir_flag) ;
            list_index++ ;
        }
    }
    while(list_index < get_num){
         entry_lists[list_index++].filelist_item_status &= ~ITEM_HAVE_DATA ;
    }
    
    if(have_more_file){ // Though "have more file", we need check if there is more file that has gGetFileType 
            get_list_num=1;
        if(next_flag)
            FileNavGetNextFileList(&file_list, &get_list_num, gGetFileType ) ;
        else
            FileNavGetPrevFileList(&file_list, &get_list_num, gGetFileType ) ;
            if(get_list_num==0)
                have_more_file=0;
    }    
    if(NODIR_FLAG==0)
    FLupdateFileListArrowShowState(have_more_file,next_flag,start_pos);
	else
    if((WinTypeChoice==VIDEO)||(WinTypeChoice==AUDIO))
    FLupdateFileListArrowShowState2(have_more_file,next_flag,start_pos);
    return have_more_file ;
}


INT32S GetNextFileListCB(INT32S start_pos, INT8U get_num, TFILELISTITEM *entry_lists)
{
  if ((NODIR_FLAG == 0)&&(ONLYDIR_FLAG==1))
	 	return GetFileListCB_OnlyDir(start_pos, get_num, entry_lists, 1) ;
    else
        return GetFileListCB(start_pos, get_num, entry_lists, 1) ;		
}

INT32S GetPrevFileListCB(INT32S start_pos, INT8U get_num, TFILELISTITEM *entry_lists)
{
if ((NODIR_FLAG == 0)&&(ONLYDIR_FLAG==1))
	 	return GetFileListCB_OnlyDir(start_pos, get_num, entry_lists, 0) ;
    else
        return GetFileListCB(start_pos, get_num, entry_lists, 0) ;  	
}

INT32S CDNewDir(INT32S entry_pos)
{
    INT32S have_more_file = 1 ;
    INT32U get_list_num = 1;
    PATHNODE file_list ;
#ifdef FILE_SORTING
    if(WinTypeChoice != PHOTO)
        FileNavSetDefaultSortType(FILENAV_SORT_TYPE, FILENAV_SORT_NUM);
    else 
        FileNavSetDefaultSortType(FILENAV_SORT_NONE, FILENAV_SORT_NUM);
#endif
    if(entry_pos == -1){ //back up dir
        return FileNavCD("..") ;
    }
    else{
        FileNavSeek(entry_pos) ;
        have_more_file = FileNavGetNextFileList(&file_list, &get_list_num, gGetFileType ) ;
        if((get_list_num)&&(file_list.path_type & NAV_IS_DIR)){
            return FileNavCD(file_list.short_name) ;
        }
    }
    return 0 ;
}

INT8U GetVideoInfo(char *file_name, VIDEO_INFO *info){
	INT32U file_type;
	
	file_type = GetMediaType(file_name);	
	if ((file_type == MEDIA_MPEG2) || (file_type == MEDIA_MPEG1)) {
		GetVOBInfo(file_name, info);
	}
	else if (file_type == MEDIA_AVI){    
		GetAVIInfo(file_name, info);
	}
	else if (file_type == MEDIA_MOV) {
		GetMOVInfo(file_name, info);
	}
#ifdef SUPPORT_RM
	else if (file_type == MEDIA_REAL) {
		GetRMInfo(file_name, info);
	}
#endif
	else {
		return 0;
	}
	return 1;	

}
char *GetFullName(INT32S entry_pos , INT32U *entry_type)
{
    INT32U get_list_num = 1;
    PATHNODE file_list ;
    FileNavSeek(entry_pos) ;
    FileNavGetNextFileList(&file_list, &get_list_num, gGetFileType ) ;
    
    if(get_list_num == 0)
        return NULL ;
    snprintf(gCurFileName, MAX_DIR_PATH_LENGTH, "%s%s", FileNavGetCurrDir(), file_list.short_name) ;
    *entry_type = file_list.path_type ;
    return gCurFileName ;
}

INT32S CDRootDir(INT8U list_num, TFILELISTITEM *entry_lists)
{
    if(list_num > FILENUMBER+2)
        return -1;
    for(int i=0; i < list_num; i++){
        entry_lists[i].filelist_item_title = (INT32U)gpFileList[i] ;
    }
#ifdef FILE_SORTING
    if(WinTypeChoice != PHOTO)
        FileNavSetDefaultSortType(FILENAV_SORT_TYPE, FILENAV_SORT_NUM);
    else 
        FileNavSetDefaultSortType(FILENAV_SORT_NONE, FILENAV_SORT_NUM);
#endif
    return FileNavCD(CurDriver) ;
}


static void FileListViewCheck_nodir(PHWND hwnd)
{
    INT32U file_type ;
    TFILELIST *pList = (TFILELIST *)hwnd ;
    INT8U index,item_num = AWGetTFilelistItemNum(pList) ;
    for(index =0; index < item_num; index++){
        file_type = (INT32U)pList->filelist_items[index].filelist_item_context ;
            if(pList->focused_item_index == index){
                if(file_type & NAV_IS_DIR){
                    pList->filelist_items[index].filelist_item_bmp = (INT32U)ICON_FILE_FILE_TYPE_FOCUS ;//(INT32U)Folder1 ;
                }
                else if(file_type & AW_AUDIO_LIST)
		      pList->filelist_items[index].filelist_item_bmp = (INT32U)ICON_FILE_MUSIC_TYPE_FOCUS ;//(INT32U)Song1 ;	                    
                else if(file_type & MEDIA_PIC)
                    pList->filelist_items[index].filelist_item_bmp = (INT32U)ICON_FILE_PHOTO_TYPE_FOCUS ;//(INT32U)Pictur1 ;
                else if(file_type & AW_VIDEO_LIST)
                    pList->filelist_items[index].filelist_item_bmp = (INT32U)ICON_FILE_MOVIE_TYPE_FOCUS ;//(INT32U)Mpeg1 ;
                else
                    pList->filelist_items[index].filelist_item_bmp = (INT32U)ICON_UNKNOW_FOCUS ;
            }
            else{
                
                if(file_type & NAV_IS_DIR){
                    pList->filelist_items[index].filelist_item_bmp = (INT32U)ICON_FILE_FILE_TYPE_LOSE ;//(INT32U)Folder0 ;
                }
                else if(file_type & AW_AUDIO_LIST)
                    pList->filelist_items[index].filelist_item_bmp = (INT32U)ICON_FILE_MUSIC_TYPE_LOSE ;//(INT32U)Song0 ;
                else if(file_type & MEDIA_PIC)
                    pList->filelist_items[index].filelist_item_bmp = (INT32U)ICON_FILE_PHOTO_TYPE_LOSE ;//(INT32U)Pictur0 ;
                else if(file_type & AW_VIDEO_LIST)
                    pList->filelist_items[index].filelist_item_bmp = (INT32U)ICON_FILE_MOVIE_TYPE_LOSE ;//(INT32U)Mpeg0 ;
                else
                    pList->filelist_items[index].filelist_item_bmp = (INT32U)ICON_UNKNOW_LOSE;
            }
    }
}

void preview_switch_timer_func(void)
{
//	if(CheckMediaPlaybackApp())
//        return ;
	if(preview_switch_timer)
	{
       	AVTimerDelete(preview_switch_timer);
       	preview_switch_timer= 0;
        AWGUISendNMMessage(MEDIA_GUI,NM_PLAY_GENERAL, (INT32U)0);
    }
}

INT32S FileListViewOnShow_nodir(PHWND hwnd, INT32S lpParam)
{
	TFILELIST *pList = (TFILELIST *)hwnd ;
    INT8U my_app_id ;
    PHWND dir_hwnd;
    char *dir_path ,*item_name;
    INT32U file_index ;
    INT32U item_type ;
    char dbg_path[18];
    
    AWGetAppID(MEDIA_GENERAL, &my_app_id) ; 
    if (FileListOnShowFlag == 0) 
    {
        InitFileIndex();
        FileListOnShowFlag = 1 ;
        pList->focused_item_index = 0 ;
        pList->first_item_index = 0 ;
        pList->list_levels = 0 ;
        pList->filelist_status &= ~T_FILELIST_DISVISABLE ;
        pList->filelist_status &= ~T_FILELIST_SHOW_UP_ARROW ;
	if(ucCopyFileFlag) 
	 {
            pList->filelist_status |= T_FILELIST_HAVE_SELECT_ITEM ;
        }
        else 
	 {
            pList->filelist_status &= ~T_FILELIST_HAVE_SELECT_ITEM ;
        }
        pList->cd_root_entry(pList->total_items, pList->filelist_items) ;
        
        if(pList->get_next_entrys(0, pList->total_items, pList->filelist_items))
            pList->filelist_status |= T_FILELIST_SHOW_DOWN_ARROW ;
        else
            pList->filelist_status &= ~T_FILELIST_SHOW_DOWN_ARROW ;
    }
    FileListViewCheck_nodir(hwnd) ;
    hwnd = hwnd->children ;
    while(hwnd) //forward this show message to all children
    {
        if(!(hwnd->style & WS_DISVISIBLE))
            AWSendMessage(hwnd, WM_SHOWWINDOW, lpParam);
        hwnd = hwnd->siblings ;
    }
    file_index = pList->filelist_items[pList->focused_item_index].filelist_item_id ;
    item_name = GetFullName(file_index, &item_type) ;
    item_type = GetMediaType(item_name);
    strcpy(preview_item_name,item_name);
//     if(item_name)
     {
	AWSetFileList(AWFindWinCtrlByName("FileListView"), NULL, NULL);
	Get_FileInfo(item_name);
	if(WinTypeChoice == VIDEO)
	gAppShowVideoID3Info(item_name,VIDEO);
		else 
			if((WinTypeChoice == AUDIO)&&(CheckMediaPlaybackApp()!=1))
				gAppShowVideoID3Info(item_name,AUDIO);	
    }
    if((item_type & AW_VIDEO_LIST)||(item_type & AW_AUDIO_LIST))
    {
		if(preview_switch_timer)
		{
       	AVTimerDelete(preview_switch_timer);
       	preview_switch_timer= 0;
		}
	preview_switch_timer = AVTimerCreateFlag(3000, (TIMER_CB_t)preview_switch_timer_func , NULL, AVTIMER_FLAG_PERIODIC);
//                            AWGUISendNMMessage(MEDIA_GUI, NM_PLAY_GENERAL, cur_level_index);
    }

    return 1 ;    
}


void GetExternName(char * filename,char *extname){
	char *text;
	
	text = strrchr(filename, '.') ;
	if(text){
		extname[0] = text[0];
		extname[1] = text[1]&0xdf;
		extname[2] = text[2]&0xdf;
		extname[3] = text[3]&0xdf;
		extname[4] = 0;
	}

}
int Get_FileInfo(char * filename)
{
    char *p_str,str_get[60];
    INT16U StrLen;
    int fd;
    struct stat stat_buf;	
    INT32U file_type;
    char *p=NULL;
	char extname[5];
	
#if 1 	
    if ((fd = open((char*)filename, O_RDONLY)) >= 0) {
        stat(filename,&stat_buf);
        file_info_onshow.file_size = stat_buf.st_size;

        file_info_onshow.time= stat_buf.st_mtime;
        strftime(fileshowtime, sizeof(fileshowtime), "%m/%d/%Y",localtime((const int *) &file_info_onshow.time));
        close(fd);
    }
    else {
	close(fd);
	memset(fileshowtime,0,20);
	file_info_onshow.file_size = 0;
	memset(file_info_onshow.file_name, 0, 256);
	memset(file_info_onshow.file_type, 0, 10);
	p = strrchr(filename, '/');		
       if (p)
        snprintf(file_info_onshow.file_name,sizeof(file_info_onshow.file_name) ,"%s", p+1);
       else	
        snprintf(file_info_onshow.file_name,sizeof(file_info_onshow.file_name) ,"%s", filename);
        return -1;
    }	
#else
    stat(filename, &stat_buf);
    file_info_onshow.file_size = stat_buf.st_size;
    file_info_onshow.time= stat_buf.st_mtime;
    strftime(fileshowtime, sizeof(fileshowtime), "%m/%d/%Y",localtime((const int *) &file_info_onshow.time));
#endif

    memset(file_info_onshow.file_name, 0, 256);
    memset(file_info_onshow.file_type, 0, 10);

    p = strrchr(filename, '/');		
    if (p)
        snprintf(file_info_onshow.file_name,sizeof(file_info_onshow.file_name) ,"%s", p+1);
    else	
        snprintf(file_info_onshow.file_name,sizeof(file_info_onshow.file_name) ,"%s", filename);

    //memcpy(file_info_onshow.file_name, &filename[offset+1], (len-offset-1));	
    file_type = GetMediaType(filename);	
	
	if (((file_type == MEDIA_MPEG1)||(file_type == MEDIA_MPEG2)||(file_type == MEDIA_AVI))
		||(file_type == MEDIA_REAL) ||(file_type == MEDIA_MOV)||(file_type == MEDIA_MP4)/*&& (NODIR_FLAG == 0)*/)
	{                                //||(file_type == MEDIA_REAL) ||(file_type == MEDIA_MOV)
		//if (NODIR_FLAG == 0){//modified by Hexiang for timesearch
			#ifdef TIME_SEARCH
			TimeSearchFlag = 1;
			#endif
			GetVideoInfo(filename,&video_inf);
			have_videoinfo_flag = 1;
		//}
	
	if (video_inf.video_type == VIDEO_TYPE_UNKNOW){
		memcpy(file_info_onshow.file_type, "UNKNOW", 6);	
	}
	else {
		if ((file_type == MEDIA_MPEG2) || (file_type == MEDIA_MPEG1)) {
			memcpy(file_info_onshow.file_type, "MPEG", 4);	
		}
		else if (file_type == MEDIA_AVI){    
			memcpy(file_info_onshow.file_type, "AVI", 3);	
		}
		else if (file_type == MEDIA_MOV) {
			memcpy(file_info_onshow.file_type, "MOV", 3);	
		}
		else if (file_type == MEDIA_REAL) {
			GetExternName(filename,extname);
			if(strncmp(extname,".RMV",4) == 0){
				memcpy(file_info_onshow.file_type, "RMVB", 4);	
			}
			else {
				memcpy(file_info_onshow.file_type, "RM", 2);	
			}			       	
		}
	}
	}
		else if ((file_type == MEDIA_GENERAL)||(file_type == MEDIA_GENERAL_)) {
			GetExternName(filename,extname);
			if(strncmp(extname,".WMA",4) == 0)
				memcpy(file_info_onshow.file_type, "WMA", 3);	
			else 
				memcpy(file_info_onshow.file_type, "MP3", 3);			
		}
		else if (file_type == MEDIA_PIC) {
			memcpy(file_info_onshow.file_type, "JPEG", 4);	
		}
		
		else if (file_type  & MEDIA_TXT) {
			GetExternName(filename,extname);
			if(strncmp(extname,".IMG",4) == 0){
				memcpy(file_info_onshow.file_type, "IMG", 3);	
			}
			else if (strncmp(extname, ".TXT", 4) == 0)
              memcpy(file_info_onshow.file_type, "TXT", 3);          			
		}
		else if(file_type == MEDIA_OTHER){
		p_str = (char *)AWGetResource(FOLDER_STR, &StrLen);
		StrLen = (StrLen < 50)?StrLen:50 ;
		strncpy(str_get, p_str, StrLen);
		str_get[StrLen] = 0 ;
			memcpy(file_info_onshow.file_type, str_get, 6);	
		}
	

    return 1;	
}


void SetVolume(unsigned char Init_Flag)
{
	if(Init_Flag)
		SetAC3CtrlReg(3,0x7fff);
	else{
		SetAC3CtrlReg(3,volume_level[Volume_Value]);
		SetSoundLevelPara(Volume_Value);
	}
}

int ProcessVolume(int key)
{
	if(isMute == MUTE)
		isMute = UNMUTE ;
		
	if(GPIO_MUTE_STATUS)
		GPIO_MB_UNMUTE;
		
	if(key == UOP_VOL_MINUS){ 
		if(Volume_Value > 0)
			Volume_Value--;
	}
	else if(key == UOP_VOL_PLUS){
			
		if(Volume_Value < 7)
			Volume_Value++;

	}
	
	SetVolume(0);
	updateVolumeState(Volume_Value);	
	
	return Volume_Value;	
}


void run_video_preview (void){
	char *item_name;
	INT32U item_type ;
	VIDEO_INFO vi;
	int ret = 0;


	item_name = preview_item_name;
	if (!item_name)
		return ;
	item_type = GetMediaType(item_name);

#ifdef SUPPORT_RM
	if (item_type == MEDIA_REAL) {
		ret = GetRMInfo(item_name, &vi) ;
		if (ret == -1){
			return ;
		}
	}
#endif	
	if ((item_type == MEDIA_MPEG1) || (item_type == MEDIA_MPEG2)){
		GetVOBInfo(item_name, &vi);
		if (vi.video_type == VIDEO_TYPE_UNKNOW){
			return;
		}
	}

	//if(item_type == MEDIA_REAL)
	//	return ;
	//AVTimeDly(1000);
 	
			
	if(CheckMediaPlaybackApp()) {
		;//check_app_flag = 1;
	}
	else {
		Playlist_t *playlist;
		int 		file_index = cur_level_index;
		INT32U app_type ;

		playlist = (Playlist_t *)fs_playlist_create(0,AW_VIDEO_LIST & NAV_PATH_TYPE ,
			PLAYLIST_TYPE_VIDEO,
			file_index,0,&app_type);
		
		preview_video = 1;				
		if ((item_type == MEDIA_MPEG2) || (item_type == MEDIA_MPEG1)) {
			//PreviewVobPlayer(item_name);
			if (RunVOBPlayer(playlist)) {
				AWPlaylistDelete2(playlist);
			}
		 	Update_Video_PreviewScreen_Screen(1) ;
		}
		else if (item_type == MEDIA_AVI){    
			if (RunAVIPlayer(playlist)) {
				AWPlaylistDelete2(playlist);
			}
			//PreviewAviPlayer(item_name);
		 	Update_Video_PreviewScreen_Screen(1) ;
		}
		else if ((item_type == MEDIA_MOV) || (item_type == MEDIA_MP4)) {
			//PreviewGPlayer(item_name);
			if (RunGPlayer(playlist)) {
				AWPlaylistDelete2(playlist);
			}
			Update_Video_PreviewScreen_Screen(1) ;
		}	
#ifdef SUPPORT_RM
		else if (item_type == MEDIA_REAL) {
			//PreviewGPlayer(item_name);
			if (RunRMPlayer(playlist)) {
				AWPlaylistDelete2(playlist);
			}
			Update_Video_PreviewScreen_Screen(1) ;
		}
#endif
	}		
//	AVTimeDly(1000);
// 	Update_Video_PreviewScreen_Screen(1) ;
}
INT32S FileListKeyDown(void){
/*
	PHWND dir_hwnd = AWFindWinCtrlByName(FileListView);
	TFILELIST *pList = (TFILELIST *)dir_hwnd ;
	char extname[5];
	static INT32U key = UOP_DOWN;
	if (GetCurIndex() == (curDirTotalItem-1)) {
		FileListKeyOnTop();
	}			
	else if (dir_hwnd) {
						
		char *item_name;
					
		dir_hwnd->pClass->ClassProc(dir_hwnd, WM_KEYDOWN, (INT32S)&key) ;//call original fun first
		ProcessFileIndex(UOP_DOWN, pList->list_levels);  
		
		if(WinTypeChoice == VIDEO)
			item_name = (char *)filelist_video[cur_level_index];
		else if(WinTypeChoice == AUDIO)
			item_name = (char *)filelist_music[cur_level_index];
		else
			item_name = 0;
			
		if (!item_name)
			return 1;
		
		Get_FileInfo(item_name);
		GetExternName(item_name,extname);
		
		if(WinTypeChoice == VIDEO)
			gAppShowVideoID3Info(item_name,VIDEO);
		else if((WinTypeChoice == AUDIO)&&(strncmp(extname,".WMA",4) == 0))
			gAppShowVideoID3Info(item_name,AUDIO);		
			
		FileListViewCheck_nodir(dir_hwnd);	
	}
	else{
		return 0;
	}
	
	return 1;	
	*/
}

INT32S FileListKeyUp(void){
	/*
	PHWND dir_hwnd = AWFindWinCtrlByName(FileListView);
	TFILELIST *pList = (TFILELIST *)dir_hwnd ;
	static INT32U key = UOP_UP;

	if(GetCurIndex() ==0) {
		FileListKeyOnBottom(); 		
	}
	else if (dir_hwnd) {
		dir_hwnd->pClass->ClassProc(dir_hwnd, WM_KEYUP, (INT32S)&key) ;//call original fun first
		ProcessFileIndex(UOP_UP, pList->list_levels);  
		FileListViewCheck_nodir(dir_hwnd);	
	}
	else{
		return 0;
	}
	return 1;
	*/
}

INT32S FileListKeyOnTop(void){
	PHWND dir_hwnd = AWFindWinCtrlByName(FileListView);
	TFILELIST *pList = (TFILELIST *)dir_hwnd ;
	INT8U my_app_id ;
	char *item_name;
	
	if (dir_hwnd){
		FileListOnShowFlag = 1 ;
		InitFileIndex();
		pList->focused_item_index = 0 ;
		pList->first_item_index = 0 ;
		pList->list_levels = 1 ;

		if(WinTypeChoice == VIDEO)
			item_name = (char *)filelist_video[cur_level_index];
		else if(WinTypeChoice == AUDIO)
			item_name = (char *)filelist_music[cur_level_index];
		else
			item_name = 0;
			
		if (!item_name)
			return 1;
		
		Get_FileInfo(item_name);
		
		if(WinTypeChoice == VIDEO)
			gAppShowVideoID3Info(item_name,VIDEO);
		else if((WinTypeChoice == AUDIO)&&(CheckMediaPlaybackApp()!=1))
			gAppShowVideoID3Info(item_name,AUDIO);

		dir_hwnd->pClass->ClassProc(dir_hwnd, WM_T_FILELIST_REFRESH, 0) ;//call original fun first

		updateFileListArrowShowState(cur_level_index, curDirTotalItem) ;
		FileListViewCheck_nodir(dir_hwnd);
		AWGetAppID(MEDIA_GENERAL, &my_app_id) ; 
		
/*		
		if((NODIR_FLAG == 1) && (Audio_App_State_Special == PLAY)){	
			AWGPLAYERQuitProcess();
			if(AVTimerIsEnabled(Music_Play_dly))
				AVTimerRestart(Music_Play_dly);
			else
				AVTimerEnable(Music_Play_dly);
		}
					
*/
		//if ((NODIR_FLAG == 1) && (AWGetAppStatus(my_app_id) == APP_RUNNING)){
			//UpdateIsProcessBarOnShowValue();
			//AWGPlayerKeyDo(UOP_NEXT_CHAP);
		//}

		Music_Play_Dlying = 0 ;
		if((WinTypeChoice == AUDIO)&&(Music_Play_flag == 1)){
			UpdateIsProcessBarOnShowValue();
			AWGPLAYERQuitProcess();
			Music_Play_flag = 2 ;
		}		

	}
	
	if(WinTypeChoice == VIDEO)
		item_name = (char *)filelist_video[cur_level_index];
	else if(WinTypeChoice == AUDIO)
		item_name = (char *)filelist_music[cur_level_index];
		
	if (!item_name)
		return 1;
	
	Get_FileInfo(item_name);
	
	if(WinTypeChoice == VIDEO)
		gAppShowVideoID3Info(item_name,VIDEO);
	else if((WinTypeChoice == AUDIO)&&(CheckMediaPlaybackApp()!=1))
		gAppShowVideoID3Info(item_name,AUDIO);
		
	return 0 ;
}

INT32S FileListKeyOnBottom(void){
	PHWND dir_hwnd = AWFindWinCtrlByName(FileListView);
	TFILELIST *pList = (TFILELIST *)dir_hwnd ;
	INT8U my_app_id ;
	static INT32U key = UOP_DOWN;
	char *item_name;
	
	if (dir_hwnd){
		pList->list_levels = 1 ;		
		
		if (curDirTotalItem>=FILENUM_ONEPAGE){	
			FileListOnShowFlag = 1 ;
			cur_level_index = curDirTotalItem - 1;
			pList->focused_item_index = FILENUM_ONEPAGE-1;
			pList->first_item_index = 0;
			GetFileListCB_nodir((curDirTotalItem - FILENUM_ONEPAGE), FILENUM_ONEPAGE, pList->filelist_items, 1);
			dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT, 0) ;//call original fun first
			pList->filelist_status |= T_FILELIST_SHOW_UP_ARROW;
		}
		else{
			pList->focused_item_index = curDirTotalItem-1;
            pList->filelist_items[cur_level_index].filelist_item_status |= ITEM_UPDATE ;
            pList->filelist_items[pList->focused_item_index].filelist_item_status |= ITEM_UPDATE ;
            pList->filelist_status |= T_FILELIST_PAINT_ITEM ;
            FileListViewCheck_nodir(dir_hwnd);
            AWSendMessage(dir_hwnd, WM_PAINT, 0) ;
			cur_level_index = curDirTotalItem-1;
		}	
		updateFileListArrowShowState(curDirTotalItem, curDirTotalItem) ;
		FileListViewCheck_nodir(dir_hwnd);

		AWGetAppID(MEDIA_GENERAL, &my_app_id) ; 
/*		
		if ((NODIR_FLAG == 1) && (Audio_App_State_Special == PLAY)){
			AWGPLAYERQuitProcess();
			if(AVTimerIsEnabled(Music_Play_dly))
				AVTimerRestart(Music_Play_dly);
			else
				AVTimerEnable(Music_Play_dly);
		}
*/		
		//if ((NODIR_FLAG == 1) && (AWGetAppStatus(my_app_id) == APP_RUNNING)){
			//UpdateIsProcessBarOnShowValue();
			//AWGPlayerKeyDo(UOP_PREVIOUS_CHAP);
		//}
		
		Music_Play_Dlying = 0 ;
		if((WinTypeChoice == AUDIO)&&(Music_Play_flag == 1)){
			UpdateIsProcessBarOnShowValue();
			AWGPLAYERQuitProcess();
			Music_Play_flag = 2 ;
		}		

	}
	
	if(WinTypeChoice == VIDEO)
		item_name = (char *)filelist_video[cur_level_index];
	else if(WinTypeChoice == AUDIO)
		item_name = (char *)filelist_music[cur_level_index];
	else
		item_name = 0;

	if (!item_name)
		return 1;

	Get_FileInfo(item_name);
	if(WinTypeChoice == VIDEO)
		gAppShowVideoID3Info(item_name,VIDEO);
	else 
	if((WinTypeChoice == AUDIO)&&(CheckMediaPlaybackApp()!=1))
		gAppShowVideoID3Info(item_name,AUDIO);

	PHWND v_hwnd = AWFindWinCtrlByName(MoveString);
		
	if((v_hwnd)&&(v_hwnd->draw_info[1].draw_data)&&
		    (v_hwnd->draw_info[1].draw_type == DT_VOSD_DATA)){
		AWVOSDDestrory((VOSD*)v_hwnd->draw_info[1].draw_data);
		v_hwnd->draw_info[1].draw_data = (INT32U)0 ;
		String_roll_state = UNROLL ;
	}
	
	return 0 ;	
}

INT32S FileListViewOnKeyPress_nodir(PHWND hwnd, INT32S lpParam)
{
	PHWND dir_hwnd ;
	TFILELIST *pList = (TFILELIST *)hwnd ;
	INT32U *key_value = (INT32U *)lpParam ;
	char *item_name; 
	INT32U file_index ;
	INT32U item_type ;
	INT32U app_type ;
	INT8U my_app_id ;
/*
//seaman
	if(*key_value == UOP_NEXT_CHAP)
		*key_value = UOP_DOWN;
	if(*key_value == UOP_PREVIOUS_CHAP)
		*key_value = UOP_UP;	
//end
*/
#ifdef KOREAR_REMOTE

	AWGetAppID(MEDIA_GENERAL, &my_app_id) ; 
    	if (AWGetAppStatus(my_app_id) == APP_RUNNING) //if is playing music,the left key and the right key will act as fast backword/forward
	{
		switch(*key_value)
		{
			case UOP_LEFT:
				*key_value = UOP_FAST_BACKWARD;
				break;
			case UOP_RIGHT:
				*key_value = UOP_FAST_FORWARD;
				break;
				
		}
	}
#endif	
	switch(*key_value){		
	 	case UOP_HOME:
		if((WinTypeChoice == AUDIO)||(WinTypeChoice == VIDEO))
			{
			if(CheckMediaPlaybackApp())
				{
				CloseMediaPlaybackApp(0xff);
				LogoHome = 1 ;
				}
			else
				{
				if(WinTypeChoice == VIDEO)
				ReloadLogo();		
				GUIShowWindow(WinDeviceSelect);	
				}
			}
		*key_value = UOP_NOP ;
		FileNavCD(CurDriver);
		break;			
		case UOP_LEFT:
		if(pList->list_levels==0)
			break;
		if (WinTypeChoice == VIDEO)
			{
			if(CheckMediaPlaybackApp())
			CloseMediaPlaybackApp(0xff);
			unsupport_item_name = NULL ;
			Update_Video_PreviewScreen_Screen(0);
			if(preview_switch_timer)
					{
       				AVTimerDelete(preview_switch_timer);
       				preview_switch_timer= 0;
					}
			}
		if((WinTypeChoice == AUDIO))
			{
			if(CheckMediaPlaybackApp()==1)
				{
				UpdateIsProcessBarOnShowValue();
				AWGPLAYERQuitProcess();
				Music_Play_flag = 2 ;
				}
			if(preview_switch_timer)
				{
       			AVTimerDelete(preview_switch_timer);
       			preview_switch_timer= 0;
				}
			}			
		if(pList->list_levels == 1)
			{
			hwnd->pClass->ClassProc(hwnd, WM_KEYDOWN, lpParam) ;//call original fun first
			FileListViewCheck_nodir(hwnd) ;
			file_index = pList->filelist_items[pList->focused_item_index].filelist_item_id ;
			cur_level_index=file_index;
			item_name = GetFullName(file_index, &item_type) ;
			strcpy(preview_item_name,item_name);
			item_type = GetMediaType(item_name);
			Get_FileInfo(item_name);
			if((item_type & AW_VIDEO_LIST)||(item_type & AW_AUDIO_LIST))
				{
				//                            if(CheckMediaPlaybackApp())
				//                                CloseMediaPlaybackApp(0xff);
				//				Update_Video_PreviewScreen_Screen(0);
				if(preview_switch_timer)
					{
       				AVTimerDelete(preview_switch_timer);
       				preview_switch_timer= 0;
					}
				preview_switch_timer = AVTimerCreateFlag(5000, (TIMER_CB_t)preview_switch_timer_func , NULL, AVTIMER_FLAG_PERIODIC);
//				AWGUISendNMMessage(MEDIA_GUI, NM_PLAY_GENERAL, cur_level_index);
				}
			if(WinTypeChoice == VIDEO)
				gAppShowVideoID3Info(item_name,VIDEO);
			else
				if((WinTypeChoice == AUDIO)&&(CheckMediaPlaybackApp()!=1))
					gAppShowVideoID3Info(item_name,AUDIO);
				else
					if(!((item_type & AW_VIDEO_LIST)||(item_type & AW_AUDIO_LIST)))
					gAppShowVideoID3Info(item_name,VIDEO);
			break ;
			}
		hwnd->pClass->ClassProc(hwnd, WM_KEYDOWN, lpParam) ;//call original fun first
		FileListViewCheck_nodir(hwnd) ;
		file_index = pList->filelist_items[pList->focused_item_index].filelist_item_id ;
		cur_level_index=file_index;
		item_name = GetFullName(file_index, &item_type) ;
		strcpy(preview_item_name,item_name);
		item_type = GetMediaType(item_name);
		Get_FileInfo(item_name);
		if((item_type & AW_VIDEO_LIST)||(item_type & AW_AUDIO_LIST))
			{
//                            if(CheckMediaPlaybackApp())
//                                CloseMediaPlaybackApp(0xff);
//			Update_Video_PreviewScreen_Screen(0);
			if(preview_switch_timer)
					{
       				AVTimerDelete(preview_switch_timer);
       				preview_switch_timer= 0;
					}
			preview_switch_timer = AVTimerCreateFlag(3000, (TIMER_CB_t)preview_switch_timer_func , NULL, AVTIMER_FLAG_PERIODIC);
//                     AWGUISendNMMessage(MEDIA_GUI, NM_PLAY_GENERAL, cur_level_index);
			}
		if(WinTypeChoice == VIDEO)
			gAppShowVideoID3Info(item_name,VIDEO);
		else
			if((WinTypeChoice == AUDIO)&&(CheckMediaPlaybackApp()!=1))
				gAppShowVideoID3Info(item_name,AUDIO);
		break ;              
		case UOP_RIGHT:		
		if(!((pList->filelist_items[pList->focused_item_index].filelist_item_status & (ITEM_IS_DIRECTORY))==(ITEM_IS_DIRECTORY)))
			{
			#if 0                   //   added by peng su   08.1.19  10:19
			file_index = pList->filelist_items[pList->focused_item_index].filelist_item_id ;
			cur_level_index=file_index;
			item_name = GetFullName(file_index, &item_type) ;
			pList->filelist_status |= T_FILELIST_PAINT_ITEM ;
			pList->filelist_items[pList->focused_item_index].filelist_item_status |= ITEM_UPDATE ;
			AWPostMessage(hwnd, WM_PAINT, 0) ;
			#endif
			return 1;
			}
		else
		 if(!((pList->filelist_items[pList->focused_item_index].filelist_item_status & (ITEM_HAVE_DATA))==(ITEM_HAVE_DATA)))    //Empty
               break;
		if (WinTypeChoice == VIDEO)
			{
			if(CheckMediaPlaybackApp())
			CloseMediaPlaybackApp(0xff);
			unsupport_item_name = NULL ;
			Update_Video_PreviewScreen_Screen(0);
			if(preview_switch_timer)
					{
       				AVTimerDelete(preview_switch_timer);
       				preview_switch_timer= 0;
					}
			}
		if((WinTypeChoice == AUDIO))
			{
			if(CheckMediaPlaybackApp()==1)
				{
				UpdateIsProcessBarOnShowValue();
				AWGPLAYERQuitProcess();
				Music_Play_flag = 2 ;
				}
			if(preview_switch_timer)
				{
       			AVTimerDelete(preview_switch_timer);
       			preview_switch_timer= 0;
				}
			}			
ENTER_NEW_DIR:
		hwnd->pClass->ClassProc(hwnd, WM_KEYDOWN, lpParam) ;//call original fun first
		FileListViewCheck_nodir(hwnd) ;
		file_index = pList->filelist_items[pList->focused_item_index].filelist_item_id ;
		cur_level_index=file_index;
		item_name = GetFullName(file_index, &item_type) ;
		strcpy(preview_item_name,item_name);
		item_type = GetMediaType(item_name);
		Get_FileInfo(item_name);
		if((item_type & AW_VIDEO_LIST)||(item_type & AW_AUDIO_LIST))
			{
			//                            if(CheckMediaPlaybackApp())
			//                                CloseMediaPlaybackApp(0xff);
			//				Update_Video_PreviewScreen_Screen(0);
			if(preview_switch_timer)
					{
       				AVTimerDelete(preview_switch_timer);
       				preview_switch_timer= 0;
					}
				preview_switch_timer = AVTimerCreateFlag(3000, (TIMER_CB_t)preview_switch_timer_func , NULL, AVTIMER_FLAG_PERIODIC);
//			AWGUISendNMMessage(MEDIA_GUI, NM_PLAY_GENERAL, cur_level_index);
			}
		if(WinTypeChoice == VIDEO)
			gAppShowVideoID3Info(item_name,VIDEO);
		else 
			if((WinTypeChoice == AUDIO)&&(CheckMediaPlaybackApp()!=1))
				gAppShowVideoID3Info(item_name,AUDIO);
		else
			if(!((item_type & AW_VIDEO_LIST)||(item_type & AW_AUDIO_LIST)))
				gAppShowVideoID3Info(item_name,VIDEO);
		break ;
		case UOP_PREVIOUS_CHAP:
		case UOP_NEXT_CHAP:
		*key_value = UOP_NOP;
		return;
		if(CheckMediaPlaybackApp())
		{
		*key_value = UOP_NOP;
		return;
		}
		if(*key_value == UOP_PREVIOUS_CHAP)
		{
		*key_value = UOP_PAGE_UP;
		}
		else 
		{
		*key_value = UOP_PAGE_DOWN;
		}
		hwnd->pClass->ClassProc(hwnd, WM_KEYDOWN, lpParam) ;//call original fun first
		FileListViewCheck_nodir(hwnd) ;
		file_index = pList->filelist_items[pList->focused_item_index].filelist_item_id ;
		item_name = GetFullName(file_index, &item_type) ;
		Get_FileInfo(item_name);
		if(WinTypeChoice == VIDEO)
			gAppShowVideoID3Info(item_name,VIDEO);
		else 
			if((WinTypeChoice == AUDIO)&&(CheckMediaPlaybackApp()!=1))
				gAppShowVideoID3Info(item_name,AUDIO);
		break ;   
		case UOP_UP:    
		if((pList->filelist_items[pList->focused_item_index].filelist_item_id)==0)
			break;
		case UOP_DOWN:
		if((pList->filelist_items[pList->focused_item_index].filelist_item_status & (ITEM_HAVE_DATA))!=(ITEM_HAVE_DATA))
			{ //no data
				break;
			}
		if (WinTypeChoice == VIDEO)
			{
			if(CheckMediaPlaybackApp())
			CloseMediaPlaybackApp(0xff);
			unsupport_item_name = NULL ;
			Update_Video_PreviewScreen_Screen(0);
			if(preview_switch_timer)
					{
       				AVTimerDelete(preview_switch_timer);
       				preview_switch_timer= 0;
					}
			}
		if((WinTypeChoice == AUDIO))
			{
			if(CheckMediaPlaybackApp()==1)
				{
				UpdateIsProcessBarOnShowValue();
				AWGPLAYERQuitProcess();
				Music_Play_flag = 2 ;
				}
			if(preview_switch_timer)
				{
       			AVTimerDelete(preview_switch_timer);
       			preview_switch_timer= 0;
				}
			}			
		hwnd->pClass->ClassProc(hwnd, WM_KEYDOWN, lpParam) ;//call original fun first
		FileListViewCheck_nodir(hwnd) ;
		file_index = pList->filelist_items[pList->focused_item_index].filelist_item_id ;
		cur_level_index=file_index;
		item_name = GetFullName(file_index, &item_type) ;
		strcpy(preview_item_name,item_name);
		item_type = GetMediaType(item_name);
		Get_FileInfo(item_name);
		if(WinTypeChoice == VIDEO)
			gAppShowVideoID3Info(item_name,VIDEO);
		else 
			if((WinTypeChoice == AUDIO)&&(CheckMediaPlaybackApp()!=1))
				gAppShowVideoID3Info(item_name,AUDIO);
			else
				if(!((item_type & AW_VIDEO_LIST)||(item_type & AW_AUDIO_LIST)))
					gAppShowVideoID3Info(item_name,VIDEO);
			if((item_type & AW_VIDEO_LIST)||(item_type & AW_AUDIO_LIST))
				{
//                            if(CheckMediaPlaybackApp())
//                                CloseMediaPlaybackApp(0xff);
//				Update_Video_PreviewScreen_Screen(0);
			if(preview_switch_timer)
					{
       				AVTimerDelete(preview_switch_timer);
       				preview_switch_timer= 0;
					}
				preview_switch_timer = AVTimerCreateFlag(3000, (TIMER_CB_t)preview_switch_timer_func , NULL, AVTIMER_FLAG_PERIODIC);
//                            AWGUISendNMMessage(MEDIA_GUI, NM_PLAY_GENERAL, cur_level_index);
				}
		break ;
		case UOP_ENTER:
#ifndef KOREAR_REMOTE
			if((WinTypeChoice == AUDIO)&&(CheckMediaPlaybackApp()==1))
			{
			break;
			}			
#endif
			INT8U DO_UOP_ENTER=1;        		 
			if((pList->filelist_items[pList->focused_item_index].filelist_item_status & (ITEM_HAVE_DATA))!=(ITEM_HAVE_DATA))
			{ //no data
				return 1;
			}
			if((pList->filelist_items[pList->focused_item_index].filelist_item_status & (ITEM_IS_DIRECTORY))==(ITEM_IS_DIRECTORY))
			{ //is dir
				goto ENTER_NEW_DIR ;
			}
			
		case UOP_END_PAUSE:
END_PAUSE_CASE:        	
			if((pList->filelist_items[pList->focused_item_index].filelist_item_status & (ITEM_IS_DIRECTORY))==(ITEM_IS_DIRECTORY))
				break;
			
			if(WinTypeChoice == AUDIO)
			{
				if(AudioStatus == AUDIO_PLAY)
				{
					#ifndef KOREAR_REMOTE
					if(*key_value==UOP_ENTER)
						*key_value = UOP_NOP ;
					else
					#endif
						*key_value = UOP_PAUSE;
					break;
				}
				else if (AudioStatus == AUDIO_PAUSE)
				{
				*key_value = UOP_END_PAUSE ;
					break;
				}
				else if (AudioStatus != AUDIO_STOP)
				{
					*key_value = UOP_END_PAUSE ;
					break;
				}
			}
			else if(WinTypeChoice == VIDEO)
			{
				disable_video_layer();
			}

			preview_video = 0;
			//	GPIO_MB_UNMUTE
			*key_value = UOP_NOP;   			
//			if (NODIR_FLAG == 1)
//				item_name = (char *)filelist_music[cur_level_index];
//			else if (NODIR_FLAG == 2)
//				item_name = (char *)filelist_video[cur_level_index];
			
			item_name = pList->get_entry_full_name(pList->filelist_items[pList->focused_item_index].filelist_item_id, &item_type) ;
			
			if(!item_name)
				break;
			AWSetFileList(AWFindWinCtrlByName("WinLogo"), NULL, NULL);
			item_type = GetMediaType(item_name) ;
			if(item_type & AW_VIDEO_LIST)
			{ //selected a AVI file, play it
				Playlist_t *playlist;
//				file_index = cur_level_index;
//				playlist = (Playlist_t *)fs_playlist_create_nodir(NULL,AW_VIDEO_LIST & NAV_PATH_TYPE ,
//					PLAYLIST_TYPE_VIDEO, file_index,0,&app_type);
				file_index = pList->filelist_items[pList->focused_item_index].filelist_item_id ;
				playlist = fs_playlist_create(NULL,AW_VIDEO_LIST & NAV_PATH_TYPE ,PLAYLIST_TYPE_VIDEO,
					file_index,0,&app_type);
				if(playlist) 
					
				{
					lv_first_item_index = pList->first_item_index;
					lv_focused_item_index =  pList->focused_item_index;
					lv_filelist_status  = pList->filelist_status;
					keep_current_index = 1;
					if(item_type == MEDIA_MPEG1) 
					{
						AWGetAppID(MEDIA_MPEG1, &my_app_id) ; 
						if (AWGetAppStatus(my_app_id) == APP_RUNNING)
						{
							vob_play_preview(item_name);
						}
						else  
						{
							if (RunVOBPlayer(playlist))
							{
								AWPlaylistDelete2(playlist);
//								Update_Video_PreviewScreen_Screen(0);
							}
						}
					}
					else if(item_type == MEDIA_AVI)
					{
						AWGetAppID(MEDIA_AVI, &my_app_id) ; 
						if (AWGetAppStatus(my_app_id) == APP_RUNNING)
						{
							avi_play_preview(item_name);
						}
						else 
						{
							if (RunAVIPlayer(playlist)) 
							{
								AWPlaylistDelete2(playlist);
//								Update_Video_PreviewScreen_Screen(0);
							}
						}
					}
					else if(item_type == MEDIA_MOV)
					{
						
						AWGetAppID(MEDIA_GENERAL, &my_app_id) ; 
						if (AWGetAppStatus(my_app_id) == APP_RUNNING)
						{
							gplayer_play_preview(item_name);
						}
						else  
						{
							if (RunGPlayer(playlist))
							{
								AWPlaylistDelete2(playlist);
//								Update_Video_PreviewScreen_Screen(0);
							}
						}
					}
#ifdef SUPPORT_RM
					else if(item_type == MEDIA_REAL)
					{
						AWGetAppID(MEDIA_REAL, &my_app_id) ;
    						if (AWGetAppStatus(my_app_id) == APP_RUNNING)
						{
							rm_play_preview(item_name);
				
						}
						else 
						{
							if (RunRMPlayer(playlist)) 
							{
								AWPlaylistDelete2(playlist);
								//Update_Video_PreviewScreen_Screen(0);
							}
						}
					}
#endif                                     

				}
			}
			else if(item_type & AW_AUDIO_LIST)
			{
				Playlist_t *Imageplaylist=NULL,*Audioplaylist=NULL;
				// file_index = cur_level_index ;
				file_index = pList->filelist_items[pList->focused_item_index].filelist_item_id ;
				//Audioplaylist = (Playlist_t *)fs_playlist_create_nodir(NULL, (MEDIA_MP3& NAV_PATH_TYPE) ,PLAYLIST_TYPE_AUDIO, file_index,0,&app_type);
				Audioplaylist = (Playlist_t *)fs_playlist_create(NULL, (AW_AUDIO_LIST& NAV_PATH_TYPE) ,
								PLAYLIST_TYPE_AUDIO, file_index,0,&app_type);
start_play1:									
				if (Audioplaylist) 
				{
					if (RunGPlayer(Audioplaylist)) 
					{
						AWPlaylistDelete2(Audioplaylist);
					}
				} 
			}
			break ;
		case UOP_MUTE:
			if( (WinTypeChoice == AUDIO)&&CheckMediaPlaybackApp() ){
				
				if(GPIO_MUTE_STATUS){
					isMute = UNMUTE;
					GPIO_MB_UNMUTE;
				}
				else{
					isMute = MUTE;
					GPIO_MB_MUTE;
				}
								
				dir_hwnd = AWFindWinCtrlByName(Sound_Volume_Panel);
				if(dir_hwnd){
					if(isMute == UNMUTE){ // UNMUTE
						waitting = 0 ;
						dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_VOLUME_BLANK ;
						dir_hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME_SPACE ;
					}	
					else { // MUTE
						dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_VOLUME_MUTE ;
						dir_hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME_SPACE ;
					}
						AWPostMessage(dir_hwnd, WM_PAINT_DRAW_INFO, 0) ;
						AWPostMessage(dir_hwnd, WM_PAINT_DRAW_INFO, 1) ;
						AWPostMessage(dir_hwnd, WM_PAINT_FINISH, 0) ;
		
				}
			}
			break;
#ifndef KOREAR_REMOTE
		case UOP_VOL_MINUS:
        case UOP_VOL_PLUS:

			if( (WinTypeChoice == AUDIO)&&CheckMediaPlaybackApp() ){
				waitting = 0 ;	
				ProcessVolume(*key_value);
			}
			
			*key_value = UOP_NOP;
				
	        break;  	
#endif
		case UOP_RESUME:
			if(WinTypeChoice == AUDIO){
				dir_hwnd = AWFindWinCtrlByName(Music_Spectrum_Panel) ;
	    		if(dir_hwnd){
	    			dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_MUSIC_SPECTRUM_BK ;
	    			dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT_DRAW_INFO, 0) ;
	    			dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT_FINISH,0) ;
	    		}
	    		
				if(CheckMediaPlaybackApp()){
					LogoResum = 1 ;	
					AWGPLAYERQuitProcess();
				}
				else
		 			ResumFromLogo();
	 		}
	 		else if(WinTypeChoice == VIDEO){
				dir_hwnd = AWFindWinCtrlByName(Video_PreviewScreen_Screen) ;
				if(dir_hwnd){
					AWHideWinControl(dir_hwnd) ;
				}
				if(CheckMediaPlaybackApp()){
					LogoResum = 1 ;	
					CloseMediaPlaybackApp(0xff);
				}
				else {
					ReloadLogo();
					ResumFromLogo();
				}
			}

			break ;	
            	
		case UOP_STOP:
			if( user_power_flag==1)
				break;
			if ((NODIR_FLAG == 1) && (AWGetAppStatus(my_app_id) != APP_RUNNING))
				break ;
			
			if(WinTypeChoice == AUDIO){
				Music_Play_flag = 0 ;
				UpdateIsProcessBarOnShowValue();

			}
			else if(WinTypeChoice == VIDEO){
				//if(CheckMediaPlaybackApp())
					//Update_Video_PreviewScreen_Screen(0);
			}
			
			
			break;            	

		case UOP_FAST_BACKWARD:
		case UOP_FAST_FORWARD:
			break;                                 //   added by su peng   08.2.19  9:21
//del by seaman			
//		case UOP_NEXT_CHAP:
//		case UOP_PREVIOUS_CHAP:
			 if(CheckMediaPlaybackApp())
          		 break;
            if(*key_value ==UOP_PREVIOUS_CHAP)
                *key_value = UOP_PAGE_UP;
            else
                *key_value = UOP_PAGE_DOWN;
			hwnd->pClass->ClassProc(hwnd, WM_KEYDOWN, lpParam) ;//call original fun first
		case UOP_ZOOM:
			if(WinTypeChoice == VIDEO){
				*key_value = UOP_NOP;
			}
       	     	break;            	            	            	            	
    }
    ClearPanelAction(key_value);
    return 0 ;
}



void String_Init_Time()
{
    snprintf(infobar_time_str, 9, "00:00:00") ;
}


void ClearPanelAction(INT32U *key_value)
{
    if((*key_value == UOP_UP) || (*key_value == UOP_DOWN) || (*key_value == UOP_LEFT)
     ||(*key_value == UOP_RIGHT) ||(*key_value == UOP_ENTER) )
    {
        *key_value = UOP_NOP ;
    }
}

INT32S LogoOnShow(PHWND hwnd, INT32S lpParam)
{
    PHWND dir_hwnd ;
    ucUseUsbFlag = 0 ;
    
    switch(CurrentOsdSize){
	case OsdSize720p:
    		Filelist_Bar_Str_len = 330 ;
			osdsettpval(0,0xf);
            break;	
	#ifdef SUPPORT_VGA
	case OsdSizeVga:
                AWSetWinStart(0,0);
		  Filelist_Bar_Str_len = 330;
		  osdsettpval(0,0xf);	
	     break;
	#endif
		 
    	case STANDARD:
	default:
    		Filelist_Bar_Str_len = 160 ;
			osdsettpval(0,0xf);
            break;		
    }
	
	WhichWindowChoiceGetIn(WinTypeChoice);
	
	dir_hwnd = AWFindWinCtrlByName(FileListView);
	if(dir_hwnd)
    	AWSetFocus(dir_hwnd) ;
    
    TFILELIST *pList = (TFILELIST *)dir_hwnd ;
    
    return 0 ;

}

INT32S Video_PreviewScreen_ScreenOnShow(PHWND hwnd,INT32S lpParam) 
 {
 	#if 1
		hwnd->draw_info[1].draw_data = (INT32U)ICON_60;
	#else
		hwnd->draw_info[1].draw_data = (INT32U)ICON_MOVIE_PREVIEW_ENABLE;
	#endif
	return 0 ;	
 }

void Update_Video_PreviewScreen_Screen(int no) 
 {
 	//char *item_name ;
	PHWND hwnd = AWFindWinCtrlByName(Video_PreviewScreen_Screen);
	if (hwnd){
		if (no == 0) {
			
			if(GetCurrVideoItemName() == unsupport_item_name )
				hwnd->draw_info[1].draw_data = (INT32U)ICON_PREV_UNSUPPORT;
			else
				hwnd->draw_info[1].draw_data = (INT32U)ICON_60;
		}
		else if (no == 1) {
			hwnd->draw_info[1].draw_data = (INT32U)ICON_MOVIE_PREVIEW_ENABLE;
		}
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 1);
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0) ; 
 	}
 }


INT32S MediaToplOnShow(PHWND hwnd, INT32S lpParam)
{
	return 0 ;	
}


INT32S gPlayerAppShowAudioID3Info()
{
    char *p_str,*str_get;
    INT16U StrLen;
    INT32S key = UOP_NOP ;
    PHWND dir_hwnd = AWFindWinCtrlByName(Music_FileInfo_Panel) ;
// cut string use
	INT32S word_width = 160, font_height, word_len;
		
    if((INT32U ) &pInfo){
 
		str_get = AVMem_umalloc(60) ;
		p_str = (char *)AWGetResource(TITLE, &StrLen);
		StrLen = (StrLen < 50)?StrLen:50 ;
		strncpy(str_get, p_str, StrLen);
		str_get[StrLen] = 0 ;
		sprintf(debug_string[0],"%s ",str_get) ;
		AVMem_free(str_get);
		sprintf(debug_string[4],"%s",&pInfo.au_ID3_Tag.title);
		StrLen = AWGetTextSize(debug_string[4], 0, &word_width, &font_height, &word_len, AWTF_ASCII) ;
		debug_string[4][StrLen] = 0 ;
		
		str_get = AVMem_umalloc(60) ;
		p_str = (char *)AWGetResource(ARTIST, &StrLen);
		StrLen = (StrLen < 50)?StrLen:50 ;
		strncpy(str_get, p_str, StrLen);
		str_get[StrLen] = 0 ;
		sprintf(debug_string[1],"%s ",str_get) ;
		AVMem_free(str_get);
		sprintf(debug_string[5],"%s",&pInfo.au_ID3_Tag.artist);
		word_width = 160 ;
		StrLen = AWGetTextSize(debug_string[5], 0, &word_width, &font_height, &word_len, AWTF_ASCII) ;
		debug_string[5][StrLen] = 0 ;
		
		str_get = AVMem_umalloc(60) ;
		p_str = (char *)AWGetResource(ALBUM, &StrLen);
		StrLen = (StrLen < 50)?StrLen:50 ;
		strncpy(str_get, p_str, StrLen);
		str_get[StrLen] = 0 ;
		sprintf(debug_string[2],"%s ",str_get) ;
		AVMem_free(str_get);
		sprintf(debug_string[6],pInfo.au_ID3_Tag.album);
		word_width = 160 ;
		StrLen = AWGetTextSize(debug_string[6], 0, &word_width, &font_height, &word_len, AWTF_ASCII) ;
		debug_string[6][StrLen] = 0 ;
		
		
		str_get = AVMem_umalloc(60) ;
		p_str = (char *)AWGetResource(YEAR, &StrLen);
		StrLen = (StrLen < 50)?StrLen:50 ;
		strncpy(str_get, p_str, StrLen);
		str_get[StrLen] = 0 ;
		sprintf(debug_string[3],"%s ",str_get) ;
		AVMem_free(str_get);
		sprintf(debug_string[7],pInfo.au_ID3_Tag.year) ;
		word_width = 160 ;
		StrLen = AWGetTextSize(debug_string[7], 0, &word_width, &font_height, &word_len, AWTF_ASCII) ;
		debug_string[7][StrLen] = 0 ;
	
		for(int i=0; i<9; i++){
				dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT_DRAW_INFO,i);
		}
		dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT_FINISH,0);

		key = UOP_NOP ;

    }
    return 0 ;
}


INT32S gAppShowVideoID3Info(char *FileName, INT8U WinChoiceType)
{

    char *p_str,*str_get;
    INT16U StrLen, i,j,k,l;
    char t_size[20];
    INT32S key = UOP_NOP ;
    PHWND dir_hwnd ;
    int file_type;	
    char extname[5];

    if(WinChoiceType == VIDEO){
    	dir_hwnd = AWFindWinCtrlByName(Video_FileInfo_Panel) ;
    	j = 3 ;
    	k = 4 ;
    	l = 5 ;
    }	
    else if(WinChoiceType == AUDIO){
    	dir_hwnd = AWFindWinCtrlByName(Music_FileInfo_Panel) ;
    	j = 4 ;
    	k = 5 ;
    	l = 6 ;
    }
    	
	str_get = AVMem_umalloc(60) ;
	p_str = (char *)AWGetResource(FILE_NAME_STR, &StrLen);
    StrLen = (StrLen < 50)?StrLen:50 ;
    strncpy(str_get, p_str, StrLen);
    str_get[StrLen] = 0 ;
	sprintf(debug_string[0],"%s ",str_get) ;
	AVMem_free(str_get);

	str_get = AVMem_umalloc(60) ;
	p_str = (char *)AWGetResource(FILE_SIZE, &StrLen);
    StrLen = (StrLen < 50)?StrLen:50 ;
    strncpy(str_get, p_str, StrLen);
    str_get[StrLen] = 0 ;
	sprintf(debug_string[1],"%s ",str_get) ;
	AVMem_free(str_get);
	
	str_get = AVMem_umalloc(60) ;
	p_str = (char *)AWGetResource(FILE_TYPE_STR, &StrLen);
    StrLen = (StrLen < 50)?StrLen:50 ;
    strncpy(str_get, p_str, StrLen);
    str_get[StrLen] = 0 ;
	sprintf(debug_string[2],"%s ",str_get) ;
	AVMem_free(str_get);
	
	if(file_info_onshow.file_size<1024){
		sprintf(t_size,"%d",file_info_onshow.file_size);
		sprintf(debug_string[k], "%s%s", t_size,"Byte");
	}
	else
	if(file_info_onshow.file_size>(1024*1024)){
		sprintf(t_size, "%d",file_info_onshow.file_size/(1024*1024));
		sprintf(debug_string[k], "%s%s", t_size,"MB");
	}
	else{
		sprintf(t_size, "%d",file_info_onshow.file_size/1024);
		sprintf(debug_string[k], "%s%s", t_size,"KB");
	}        

	memset(debug_string[j],0,150);
	StringCopyByLen(debug_string[j], file_info_onshow.file_name, dir_hwnd->draw_info[k].draw_width, 0);
			
	file_type = GetMediaType(FileName);	
	memset(file_info_onshow.file_type, 0, 10);
	switch(file_type)
	{
	    case MEDIA_MPEG1:   //MEDIA_MPEG2:
		    memcpy(file_info_onshow.file_type, "MPEG", 4);
		    break;
        case MEDIA_AVI:    
		    memcpy(file_info_onshow.file_type, "AVI", 3);
            break;
        case MEDIA_MOV:    
            memcpy(file_info_onshow.file_type, "MOV", 3);
            break;
	    case MEDIA_REAL:
            GetExternName(FileName,extname);
            if(strncmp(extname,".RMV",4) == 0)
            {
                memcpy(file_info_onshow.file_type, "RMVB", 4);	
            }
            else
            {
                memcpy(file_info_onshow.file_type, "RM", 2);	
            }
            break;
		case MEDIA_MP3:       
            GetExternName(FileName,extname);
            if(strncmp(extname,".WMA",4) == 0)
                memcpy(file_info_onshow.file_type, "WMA", 3);	
            else 
                memcpy(file_info_onshow.file_type, "MP3", 3);
            break;
        case MEDIA_PIC:    
			memcpy(file_info_onshow.file_type, "JPEG", 7);	
            break;
        case MEDIA_TXT:
            GetExternName(FileName,extname);
            if(strncmp(extname,".IMG",4) == 0)
            {
                memcpy(file_info_onshow.file_type, "IMG", 3);	
			}
			else
			{
                memcpy(file_info_onshow.file_type, "UNKNOW", 6);	
			}			
            break;
        case MEDIA_OTHER:
            memcpy(file_info_onshow.file_type, "Folder", 6);	
            break;
        default:
            memcpy(file_info_onshow.file_type, "UNKNOW", 6);	
            break;
    }
	sprintf(debug_string[l],"%s",file_info_onshow.file_type);
    
    if(WinChoiceType == VIDEO)
	    for(i=0;i<7;i++){  
			dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT_DRAW_INFO,i);
		}
	else if(WinChoiceType == AUDIO){
		debug_string[3][0] = 0 ;
		debug_string[7][0] = 0 ;
	    for(i=0;i<9;i++){  
			dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT_DRAW_INFO,i);
		}
	}			
	
	 dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT_FINISH,0);
    
		key = UOP_NOP ;

    return 0 ;
}

void gPlayerUpdateAudioTotalTime(INT32S total_time)
{
	INT32S time_min = 0 ;
	INT32S time_sec = 0 ;
	
	time_min = total_time/60 ;
	time_sec = total_time%60 ;
	
	sprintf(mediabox_time_str, "%02d:%02d", time_min, time_sec);
	
	PHWND hwnd = AWFindWinCtrlByName(Music_ProcessBar_Panel);
	if((hwnd)&&(IsProcessBarOnShow == 0)){ // to draw this area no more than 2 times 
		hwnd->draw_info[0].draw_data = (INT32U)ICON_MUSIC_PLAY_BAR;
		hwnd->draw_info[4].draw_data = (INT32U)ICON_MUSIC_TIME_BLANK;
		
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 0);
		//hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 1);
		//hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 2);
		//hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 3);
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 4);
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 5);
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0) ; 
		IsProcessBarOnShow = 1 ;
	}
	return;		
}

void UpdateAudioProcessBar(INT32S total_time, INT32S curr_time)
{
	PIXELVAL old_color;
	
	PHWND hwnd = AWFindWinCtrlByName(Music_ProcessBar_Panel);
	if(hwnd){
		if(hwnd->draw_info[3].draw_data == (INT32U)0)
			hwnd->draw_info[3].draw_data = (INT32U)ICON_MUSIC_PROCESSBAR_BLANK;
			
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 3);
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0) ; 
	}

	INT32S x = hwnd->draw_info[3].draw_pos_x ;
	INT32S y = hwnd->draw_info[3].draw_pos_y ;
	INT32S h = hwnd->draw_info[3].draw_height ;
	INT32S w = hwnd->draw_info[3].draw_width ; 
			
	old_color = AWSetForeground(15);
	
	if(total_time>0){
		w = (w * curr_time);
		w = w / total_time ;
		if((w < hwnd->draw_info[3].draw_width)||(w == hwnd->draw_info[3].draw_width))
			AWFillRectTxt(x,y,w,h);
	}	
	AWSetForeground(old_color) ;
}

INT32S iniFileInfoShow()
{
	
//	FileListInitData();//opened by Hexiang for music hotkey
	LogoResum = 0 ;
	LogoHome = 0 ;
	String_roll_state = UNROLL ;
	roll_string_timeout = 0 ;
	caption_moving_timer = 0 ;
	//Music_Play_dly = 0 ;
	unsupport_item_name = NULL ;
	//Music_Play_Dlying = 0 ;
	//Music_Play_flag = 0 ;
	//Audio_App_State_Special = STOP ;
	
	//Music_Play_dly = AVTimerCreate(500, Music_Play_dly_fun, NULL) ;
	//AVTimerDisable(Music_Play_dly);
	
	debug_string[0][0] = 0;
	debug_string[1][0] = 0;
	debug_string[2][0] = 0;
	debug_string[3][0] = 0;

	debug_string[4][0] = 0;
	debug_string[5][0] = 0;
	debug_string[6][0] = 0;
	debug_string[7][0] = 0;
    
    return 0 ;
}

INT32S updateFileListArrowShowState(INT32S currItemIndex, INT32U totalItem)
{
	INT8U NUM = 7 ;
	PHWND hwnd = AWFindWinCtrlByName(Media_FileList_BK_Panel);
	
	if(!hwnd) 
		return 1 ;
	
	if( (totalItem > 0)&&((currItemIndex > 0)||(currItemIndex == 0)) ){

		if(totalItem > NUM){
			if(currItemIndex == 0){
				if(WinTypeChoice == VIDEO){
					hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND_UP ;
					hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_DOWN_VIDEO ;
				}
				else
				if(WinTypeChoice == AUDIO){
					hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND ;
					hwnd->draw_info[2].draw_data = (INT32U)ICON_FILELIST_DOWN ;
				}
				
			}
			else {
				if(WinTypeChoice == VIDEO){
					hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_UP_VIDEO ;
					hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND_DOWN;
				}
				else
				if(WinTypeChoice == AUDIO){
					hwnd->draw_info[1].draw_data = (INT32U)ICON_FILELIST_UP ;
					hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND ;
				}
			}
		}
		else
		if((totalItem < NUM)||(totalItem == NUM)){
			if(WinTypeChoice == VIDEO){
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND_UP ;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND_DOWN ;				

			}
			else if(WinTypeChoice == AUDIO){
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND ;
				hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND ;
			}
		} // end if totalitem < num
		
	}
	
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 1);
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 2);
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0);
	
	return 0;
	
}

// Msg respond
void updateAudioPlayStateWhenMsgProc(AWMSG *pMsg, INT8U ff_level, INT8U fb_level)
{
	PHWND hwnd = AWFindWinCtrlByName(Music_ProcessBar_Panel);
	if(!hwnd)
		return ;
	
	// change ICON by msg_id
	switch(pMsg->msg_value){
		case GPLAYER_PLAY:
			hwnd->draw_info[1].draw_data = (INT32U)ICON_INFO_PLAY;
			hwnd->draw_info[2].draw_data = (INT32U)ICON_INFO_BLANK;
			AudioStatus = AUDIO_PLAY;
			//Audio_App_State_Special = PLAY ;
			//Music_Play_flag = 1;
			break;
			
		case GPLAYER_PAUSE:
			hwnd->draw_info[1].draw_data = (INT32U)ICON_INFO_PAUSE;
			hwnd->draw_info[2].draw_data = (INT32U)ICON_INFO_BLANK;
			AudioStatus = AUDIO_PAUSE;
			break;
			
		case GPLAYER_STOP:
		case GPLAYER_QUIT:	
			PHWND dir_hwnd = AWFindWinCtrlByName(Music_Spectrum_Panel) ;
	    	if(dir_hwnd){
	    		dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_MUSIC_SPECTRUM_BK ;
	    		dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT_DRAW_INFO, 0) ;
	    		dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT_FINISH,0) ;
	    	}
			
			if(IsProcessBarOnShow != 1){
				hwnd->draw_info[0].draw_data = (INT32U)ICON_MUSIC_PLAY_BAR_BK;
				hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 0);
			}
			hwnd->draw_info[1].draw_data = (INT32U)0;
			mediabox_time_str[0] = '\0';
			hwnd->draw_info[2].draw_data = (INT32U)0;
			
			Get_FileInfo(preview_item_name);
			gAppShowVideoID3Info(preview_item_name,AUDIO);
			AudioStatus = AUDIO_STOP;
			break;
			
		case GPLAYER_SEAMLESS_FF:
			hwnd->draw_info[1].draw_data = (INT32U)ICON_INFO_FF;
			
			if(ff_level == 2){
				hwnd->draw_info[2].draw_data = (INT32U)ICON_2_MUSIC;
				AudioStatus = AUDIO_FAST_FOR_1;
			}
			else if(ff_level == 3){
				hwnd->draw_info[2].draw_data = (INT32U)ICON_4_MUSIC;
				AudioStatus = AUDIO_FAST_FOR_2;
			}
			else if(ff_level == 4){
				hwnd->draw_info[2].draw_data = (INT32U)ICON_8_MUSIC;
				AudioStatus = AUDIO_FAST_FOR_3;
			}
			
			break;
			
		case GPLAYER_SEAMLESS_FB:
			hwnd->draw_info[1].draw_data = (INT32U)ICON_INFO_FB;
			
			if(fb_level == 2){
				hwnd->draw_info[2].draw_data = (INT32U)ICON_2_MUSIC;
				AudioStatus = AUDIO_FAST_BACK_1 ;
			}
			else if(fb_level == 3){
				hwnd->draw_info[2].draw_data = (INT32U)ICON_4_MUSIC;
				AudioStatus = AUDIO_FAST_BACK_2 ;
			}
			else if(fb_level == 4){
				hwnd->draw_info[2].draw_data = (INT32U)ICON_8_MUSIC;
				AudioStatus = AUDIO_FAST_BACK_3 ;
			}	

			break;
			
		default:
			
			break;
	}
	
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 1);
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 2);
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0);
}	


INT32S updateFileListArrowShowState2(INT32S have_more_file, INT8U next_flag, INT32S currItemIndex, INT32U totalItem,INT32U Num)
{
	PHWND hwnd = AWFindWinCtrlByName(Media_FileList_BK_Panel);
	if(!hwnd) 
		return 0;
		
	if(totalItem == Num)
		return 0;
	
	if(next_flag == 0){ // Prev
		if(have_more_file){
			if((currItemIndex - 1) == 0)  {// the top one
				if(WinTypeChoice == VIDEO)
					hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND_UP ;
				else
				if(WinTypeChoice == AUDIO)
					hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_BACKGROUND ;
			}
			else{
				if(WinTypeChoice == VIDEO)
					hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_UP_VIDEO ;
				else
				if(WinTypeChoice == AUDIO)
					hwnd->draw_info[1].draw_data = (INT32U)ICON_FILELIST_UP ;
			}
			
			if(totalItem > Num){
				if(WinTypeChoice == VIDEO)
					hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_DOWN_VIDEO ;	
				else
				if(WinTypeChoice == AUDIO)
					hwnd->draw_info[2].draw_data = (INT32U)ICON_FILELIST_DOWN ;	
			}
			else {
				if(WinTypeChoice == VIDEO)
					hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND_DOWN ;	
				else
				if(WinTypeChoice == AUDIO)
					hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND ;	
			}
		} // end if have_more_file
	} // end if next_flag

	else 
// totalitem = max(curritemindex) + 1 so when curritem is the last sec one ,the have_more_file have one
	if(next_flag == 1){ // Next
		if(have_more_file){
			if(WinTypeChoice == VIDEO)
				hwnd->draw_info[1].draw_data = (INT32U)ICON_ARROW_UP_VIDEO ;
			else
			if(WinTypeChoice == AUDIO)
				hwnd->draw_info[1].draw_data = (INT32U)ICON_FILELIST_UP ;
				
			if((currItemIndex + 1) == (totalItem - 1)){
				if(WinTypeChoice == VIDEO)
					hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND_DOWN ;
				else
				if(WinTypeChoice == AUDIO)
					hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_BACKGROUND ;
			}
			else {
				if(WinTypeChoice == VIDEO)
					hwnd->draw_info[2].draw_data = (INT32U)ICON_ARROW_DOWN_VIDEO ;
				else
				if(WinTypeChoice == AUDIO)
					hwnd->draw_info[2].draw_data = (INT32U)ICON_FILELIST_DOWN ;
			}
		} // end of have more file

	} // end of next flag

	if(FilelistView_onShow_Flag == 0){
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 1);
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 2);
		hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0);
	}
	
	FilelistView_onShow_Flag = 0 ;
	return 0;
	
}

int ProcessVolume_Common(int flag)
{
	if((flag == 1)&&(Volume_Value>0)){
		if(!GPIO_MUTE_STATUS)
		{
			Volume_Value--;
		}
		SetVolume(0);

	}else if((flag == 0)&&(Volume_Value<7)){
		if(!GPIO_MUTE_STATUS)
		{
			Volume_Value++;
		}
		SetVolume(0);
	}
	return Volume_Value;	
}

INT32S FileListViewOnOtherEvent(PHWND hwnd, INT32U msg_type, INT32S lpParam)
{
	switch(msg_type){
		case WM_SECOND_TIMEOUT:
			
			if(WinTypeChoice == VIDEO){
				if(showlogowait < 3)
					if(++showlogowait == 2)
						disable_video_layer();
			}
			else {			
				if(isMute == MUTE)
					break ;
			
				PHWND dir_hwnd = AWFindWinCtrlByName(Sound_Volume_Panel);	
				if(AWIsVisibleWinControl(dir_hwnd)){
					if(waitting<WaitFor)
						waitting++;
					else{
						dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_VOLUME_BLANK ;
						dir_hwnd->draw_info[1].draw_data = (INT32U)ICON_VOLUME_SPACE;
						dir_hwnd->pClass->ClassProc(dir_hwnd,WM_PAINT_DRAW_INFO,0) ;
						dir_hwnd->pClass->ClassProc(dir_hwnd,WM_PAINT_DRAW_INFO,1) ;
						dir_hwnd->pClass->ClassProc(dir_hwnd,WM_PAINT_FINISH,0) ;
						
					}	
				} // end ctrl isvisible
			} // end else
			
			break;
		
		default:
			break;
	}
	return 0 ;
}

INT32S Music_FileInfo_PanelOnPaint(PHWND hwnd, INT32S lpParam)
{
	return 1 ;
}

INT32S Video_FileInfo_PanelOnPaint(PHWND hwnd, INT32S lpParam)
{
	return 1 ;	
}

INT8U GetDecibleVal(int v)
{
    int val =  (-20*log10(v/32767.0))/2;
    if(val>24)
        val = 24;
    if(val<0)
	val=0;
    return 24-val;
}

void UpDateSpectrumDisplay(int *Data_Arrow)
{
    int Spectrum_height=0;
    int i=1;
    PHWND hwnd = AWFindWinCtrlByName(Music_Spectrum_Panel) ;
    hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, 0);
#ifdef TV_MODE_1080P
	if(CurrentOsdSize==OsdSize1080p) {    
	    for(i=1;i<15;i++)
	    {
	        Spectrum_height = GetDecibleVal(Data_Arrow[i]);
	
			if(hwnd->draw_info[i].draw_data!=(INT32U)SpeTable_14[Spectrum_height])
			{
				hwnd->draw_info[i].draw_data=(INT32U)SpeTable_14[Spectrum_height];
				hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, i) ;
			}
	    }
	} else
#endif 
#ifdef TV_MODE_720P
	if(CurrentOsdSize==OsdSize720p) {    
	    for(i=1;i<15;i++)
	    {
	        Spectrum_height = GetDecibleVal(Data_Arrow[i]);
	
			if(hwnd->draw_info[i].draw_data!=(INT32U)SpeTable_14[Spectrum_height])
			{
				hwnd->draw_info[i].draw_data=(INT32U)SpeTable_14[Spectrum_height];
				hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, i) ;
			}
	    }
	} else
#endif 
	{
	    for(i=1;i<15;i++)
	    {
	        Spectrum_height = GetDecibleVal(Data_Arrow[i]);
	
			if(hwnd->draw_info[i].draw_data!=(INT32U)SpeTable_8[Spectrum_height])
			{
				hwnd->draw_info[i].draw_data=(INT32U)SpeTable_8[Spectrum_height];
				hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, i) ;
			}
	    }	
	}
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0);
}


INT32U FileListViewOnPaint(PHWND hwnd, INT32U lpParam)
{
	if(!AWIsVisibleWinControl(hwnd))
		return 1 ;
		
	hwnd->pClass->ClassProc(hwnd, WM_PAINT, 1) ;

	PHWND dir_hwnd = AWFindWinCtrlByName(MoveString);
		
	if((dir_hwnd->draw_info[1].draw_data)&&
		    (dir_hwnd->draw_info[1].draw_type == DT_VOSD_DATA)){
		AWVOSDDestrory((VOSD*)dir_hwnd->draw_info[1].draw_data);
		dir_hwnd->draw_info[1].draw_data = (INT32U)0 ;
		String_roll_state = UNROLL ;
	}
	
	return 1 ;	
}

INT32U MoveStringOnShow(PHWND hwnd, INT32U lpParam)
{
	return 0 ;	
}

INT32U MoveStringOnPaint(PHWND hwnd, INT32U lpParam)
{
	return 0 ;
}

void vosd_selfroll_string(PHWND hwnd, int index, char *filestring, 
	COORD opposite_play_x, COORD opposite_play_y, AVTimer_t *caption_moving_timer, 
	TIMER_CB_t caption_moving_time_func, INT32U StopRollStrLen,INT8U rolltype, INT8U IsRollShortStr)
{
	INT32S word_width, font_height, word_len, vosd_width ;
	char t[256];
	memset(t,0,256);
	
	AWGetTextSize(filestring, strlen(filestring),&word_width,&font_height,&word_len, AWTF_ASCII) ;
	
	RECT init_clip ;
	init_clip.top = 0 ;
	init_clip.left = 0 ;	
	init_clip.width = hwnd->draw_info[index].draw_width ;
	init_clip.height = font_height ; 
	
    hwnd->draw_info[index].draw_type = DT_VOSD_DATA ;
    		
	if(hwnd->draw_info[index].draw_data){
		AWVOSDDestrory((VOSD*)hwnd->draw_info[index].draw_data);
		hwnd->draw_info[index].draw_data = (INT32U)0 ;
	}
	
	if((word_width + 104) < hwnd->draw_info[index].draw_width)
		vosd_width = hwnd->draw_info[index].draw_width ;
	else
		vosd_width = word_width + 104 ;
		
	VOSD* pVosd ;
	hwnd->draw_info[index].draw_data 
			= (INT32U)AWVOSDCreate(
									vosd_width, 
									hwnd->draw_info[index].draw_height, 
									8, 
									VOSD_SELFROLL, 
									(hwnd->winrect.left + opposite_play_x), 
									(hwnd->winrect.top + opposite_play_y),
									&init_clip, 
									NULL
			  					  );
        if(hwnd->draw_info[index].draw_data==0){
#ifndef __ROM_
            printf("AWVOSDCreate faile, check the parameters width %d, height %d, x %d, y %d, clip.left %d, clip.top %d, clip.width %d, clip.height %d \n",
                    vosd_width,hwnd->draw_info[index].draw_height,(hwnd->winrect.left + opposite_play_x),(hwnd->winrect.top + opposite_play_y),
                    init_clip.left,init_clip.top,init_clip.width,init_clip.height);
            while(1){};        
#endif            
        }            			  					  
	
	pVosd = (VOSD*)hwnd->draw_info[index].draw_data ;
	pVosd->bg = 0x23 ;

/*
	if((IsRollShortStr == UNROLL)&&(word_width < hwnd->draw_info[index].draw_width)){
			
		memset(t,0,256);
		StringCopyByLen(t, filestring, StopRollStrLen, 0);
			
		AWTextEx((VOSD*)hwnd->draw_info[index].draw_data, 
					t, 
					strlen(filestring),
					0,
					0,
					//&word_width, 
					&vosd_width,
					&font_height, 
					AWGetForeground(), 
					0, 
					AWTF_ASCII
				);

	}
	else 
	*/
	{
		AWTextEx((VOSD*)hwnd->draw_info[index].draw_data, 
					filestring, 
					strlen(filestring),
					0,
					0,
					//&word_width, 
					&vosd_width,
					&font_height, 
					AWGetForeground(), 
					0, 
					AWTF_ASCII
				);
	}
	
	// hwnd->draw_info[index].draw_type = DT_VOSD_DATA;
    hwnd->draw_info[index].draw_type_ext = MOVING_VOSD_RESET;

	hwnd->pClass->ClassProc(hwnd, WM_PAINT_DRAW_INFO, index);
	hwnd->pClass->ClassProc(hwnd, WM_PAINT_FINISH, 0);

    if(*caption_moving_timer){
		AVTimerDelete(*caption_moving_timer);
		*caption_moving_timer= 0;
		//avtimer_free(*caption_moving_timer);
	}
	
	if((IsRollShortStr == UNROLL)&&(word_width < hwnd->draw_info[index].draw_width)){
		return ;
	}
	else {
		*caption_moving_timer = AVTimerCreateFlag(100, caption_moving_time_func , hwnd, AVTIMER_FLAG_PERIODIC);
	
		if((rolltype > 0)&&(rolltype < 14)) // 1~13
			hwnd->draw_info[index].draw_type_ext = rolltype ;
		else
			hwnd->draw_info[index].draw_type_ext = MOVING_VOSD_LEFT ;
	
	    hwnd->draw_info[index].draw_arg_ext = 1;	
    }
    return ;
}    


static void caption_moving_time_func_1(void *arg)
{
    PHWND hwnd=(PHWND)arg;
    if(!AWIsVisibleWinControl(hwnd))
    	return ;
    	
    AWPostMessage(hwnd, WM_PAINT_DRAW_INFO, 1) ;
    AVSysEvent_Post(gAppAgrs[gAWGUIAppID].app_event_handle) ;
    return ;
}

INT32U LogoOnHide(PHWND hwnd, INT32S lpParam)
{
    switch(CurrentOsdSize){
	#ifdef SUPPORT_VGA
	case OsdSizeVga:
                AWSetWinStart(WinStart_x,WinStart_y);
	     break;
	#endif
		 
	default:
            break;			
    }
	AVTimerDelete(caption_moving_timer);
	// avtimer_free(caption_moving_timer) ;
	
	//AVTimerDelete(Music_Play_dly);
	//avtimer_free(Music_Play_dly) ;
	preview_video = 0 ;

	return 0 ;	
}

INT8U Check_string_is_roll(void)
{
	if(String_roll_state == ROLL)
		return	ROLL ;
	else
	if(String_roll_state == UNROLL)
		return UNROLL ;
	else
		return UNROLL ;
}


void FileListViewStringRollDelaySecond()
{
	PHWND dir_hwnd = AWFindWinCtrlByName(MoveString);
	PHWND hwnd = AWFindWinCtrlByName(FileListView);
	char * filename ;
	char *item_name;
	INT32U file_index ;
	INT32U item_type ;
	if((!dir_hwnd)||(!hwnd))
		return ;
	
	char t[256] ;
	memset(t,0,256);
	TFILELIST *pList = (TFILELIST *)hwnd ;
	if(file_info_onshow.file_name[0] == 0){
	/*	
		if(WinTypeChoice == VIDEO)
			filename = (char *)filelist_video[cur_level_index];
		else if(WinTypeChoice == AUDIO)
			filename = (char *)filelist_music[cur_level_index];
		else
			filename = 0;
		
		if(filename)
			snprintf( t,sizeof(t), "%s", strrchr(filename, '/')+1 );
		else
			return ;
			*/
		file_index = pList->filelist_items[pList->focused_item_index].filelist_item_id ;
        item_name = GetFullName(file_index, &item_type) ;
//        Get_FileInfo(item_name);
//        g_item_name = item_name;
        item_type = GetMediaType(item_name);
		if(item_name)
			snprintf( t,sizeof(t), "%s", strrchr(item_name, '/')+1 );
						
					
	}
	else
		snprintf(t,sizeof(t),"%s",file_info_onshow.file_name);
	
	if(!AWIsVisibleWinControl(dir_hwnd))
		dir_hwnd->style = WS_CHILDWINDOW ;

	dir_hwnd->winrect.top = hwnd->winrect.top + ((pList->focused_item_index+7-pList->first_item_index)%7)*(hwnd->winrect.height/7);
	dir_hwnd->winrect.left = hwnd->winrect.left + pList->filelist_title_start_x ;
	dir_hwnd->draw_info[0].draw_pos_x = hwnd->winrect.left + pList->filelist_title_start_x ;
	dir_hwnd->draw_info[0].draw_pos_y = hwnd->winrect.top + ((pList->focused_item_index+7-pList->first_item_index)%7)*(hwnd->winrect.height/7) ;

	dir_hwnd->draw_info[0].draw_data = (INT32U)ICON_PLAYLIST_BAR_FOCUS_ROLLSTRING ;
	dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT_DRAW_INFO, 0);
	dir_hwnd->pClass->ClassProc(dir_hwnd, WM_PAINT_FINISH, 0);
	AV_invalidate_dcache();
	vosd_selfroll_string(dir_hwnd, 
						 1, 
						 t, 
						 0, 
						 pList->filelist_title_start_y, 
						 &caption_moving_timer, 
						 caption_moving_time_func_1, 
						 Filelist_Bar_Str_len ,							 
						 MOVING_VOSD_LEFT_ROLL, 
						 UNROLL
						 );
	
	String_roll_state = ROLL ;

}

void UpdateIsProcessBarOnShowValue(void)
{
	IsProcessBarOnShow = 0 ;	
	return ;	
}

void Setkeep_current_index(INT8U keepCurrentIndex)
{
	keep_current_index = keepCurrentIndex ;
	
	return ;	
}

void StringCopyByLen(char *listname, char *filename, INT32S len, int nodir_flag)
{
	INT16U str_len ,strlen_suffix = 3;
//	static 
	char suffix[256];
	INT32S word_width ,font_height, word_len , len_suffix, len_final ;

	memset(suffix, 0, 256);
	
	if(strlen(filename) < 256) {
		AWGetTextSize(filename, 0,&word_width,&font_height,&word_len, AWTF_ASCII) ;
		if((len > word_width)||(len == word_width)){
			sprintf(listname, "%s", filename) ;
			return ;
		}
		else {
			if(nodir_flag == 0){
				sprintf(suffix, "%s", strrchr(filename, '.'));
				// strlen_suffix = strlen(suffix) - 1 ;
				AWGetTextSize(suffix, 0, &len_suffix, &font_height, &word_len, AWTF_ASCII) ;
				len_final = len - len_suffix ;
				if(len_final > 0){
					str_len = AWGetTextSize(filename,0, &len_final, &font_height, &word_len, AWTF_ASCII) ;
					
					if(str_len > 3){
						strncpy(listname, filename, (str_len - 3) );
						strcat(listname," ~");
						strcat(listname, suffix) ;
				//	 listname[SHOW_FILE_NAME_LENGTH-1] = 0 ; //evan:2007_10_9
					}
					else{
						goto SPECIAL_CASES ;
						//str_len = AWGetTextSize(filename,0, &len, &font_height, &word_len, AWTF_ASCII) ;
					
						//strncpy(listname, filename, (str_len - 3) );
						//strcat(listname," ~");
					}
				}
				else{
					goto SPECIAL_CASES ;
					//str_len = AWGetTextSize(filename,0, &len, &font_height, &word_len, AWTF_ASCII) ;
					
					//strncpy(listname, filename, (str_len - 3) );
					//strcat(listname," ~");
				}
			}
			else {
SPECIAL_CASES:
				str_len = AWGetTextSize(filename,0, &len, &font_height, &word_len, AWTF_ASCII) ;
				
				strncpy(listname, filename, (str_len - 3) );
				strcat(listname," ~");
			//	listname[SHOW_FILE_NAME_LENGTH-1] = 0 ; 
			}	
		
			return ;
		}
	}
	
	else {
		return ;
	}
}

#if 0
void Music_Play_dly_fun(void *arg)
{
	INT32U app_type ;

	UpdateIsProcessBarOnShowValue();
				
	Playlist_t *Imageplaylist=NULL,*Audioplaylist=NULL;

	int file_index = cur_level_index ;
	Audioplaylist = 
	(Playlist_t *)fs_playlist_create_nodir(NULL, 
										   (AW_AUDIO_LIST& NAV_PATH_TYPE) ,
										   PLAYLIST_TYPE_AUDIO,
		  								   file_index,
		  								   0,
		  								   &app_type
		  								   );

	if (Audioplaylist) 
		if(RunGPlayer(Audioplaylist)) 
			AWPlaylistDelete2(Audioplaylist);

}
#endif

void ResumFromLogo()
{
	GUIHideWindow(WinLogo);
	GUIShowWindow(WinFileTypeSelect) ;
	
	preview_video = 0;
	have_videoinfo_flag = 0;	
}

void HomeKeyFromLogo()
{
	GUIHideWindow(WinLogo);
	ReloadLogo();
	FileNavCD(CurDriver);
	GUIShowWindow(WinDeviceSelect);	
	
	preview_video = 0;
	//NODIR_FLAG = 0;
	have_videoinfo_flag = 0;	
}


void GetCurrUnSupportItemName()
{
	unsupport_item_name = (char *)filelist_video[cur_level_index];	
}

char *GetCurrVideoItemName()
{
	return preview_item_name;	
}

INT8U DlyRunMusicPlay()
{
	Playlist_t *Audioplaylist=NULL;
	INT32U app_type ;

	int file_index = cur_level_index ;
	Audioplaylist = (Playlist_t *)fs_playlist_create(
											0, 
											(AW_AUDIO_LIST& NAV_PATH_TYPE) ,
											PLAYLIST_TYPE_AUDIO,
											file_index,
											0,
											&app_type
											);

	if (Audioplaylist) {
		if (RunGPlayer(Audioplaylist)) {
			AWPlaylistDelete2(Audioplaylist);
			return 1 ;
		}
		else {return 0 ;}
    }
    else {return 0 ;} 
			
}
#ifdef ZOOM_IN
void  AW_SetVideoZoomDown( int reduce_level)
{
	int  video_frame[4] = {0, 0, 0, 0};
	int  video_fd;
	video_appmode_t video_appmode;

	video_fd=open("/dev/video",O_RDONLY);
	ioctl(video_fd, VIDEOIO_GETAPPMODE, &video_appmode);
	switch(reduce_level)//Store window position 
	{
		case 0:
			if(CurrentOsdSize == OsdSize480i || CurrentOsdSize == OsdSize480iCVBS||CurrentOsdSize == OsdSize480p)
			{
				video_frame[0] = 0;
				video_frame[1] = 0;
				video_frame[2] = 720;
				video_frame[3] = 480;
			}else if(CurrentOsdSize == OsdSize576i ||CurrentOsdSize == OsdSize576iCVBS||CurrentOsdSize == OsdSize576p)
			{
				video_frame[0] = 0;
				video_frame[1] = 0;
				video_frame[2] = 720;
				video_frame[3] = 576;
			}else
			{
				video_frame[0] = 0;
				video_frame[1] = 0;
				video_frame[2] = 1280;
				video_frame[3] = 720;
			}			
		break;
		case 1://5/6
			if(CurrentOsdSize == OsdSize480i||CurrentOsdSize == OsdSize480iCVBS||CurrentOsdSize == OsdSize480p)
			{
				video_frame[0] = 40;//60;
				video_frame[1] = 60;//90;
				video_frame[2] = 600;//540;
				video_frame[3] = 400;//360;
			}else if(CurrentOsdSize == OsdSize576i ||CurrentOsdSize == OsdSize576iCVBS||CurrentOsdSize == OsdSize576p)
			{
				video_frame[0] = 48;//72;
				video_frame[1] = 60;//90;
				video_frame[2] = 600;//540;
				video_frame[3] = 480;//432;
			}
			else
			{
				video_frame[0] = 60;//90;
				video_frame[1] = 107;//160;
				video_frame[2] = 1067;//960;
				video_frame[3] = 600;//540;
			}			
		break;

		case 2://3
			if(CurrentOsdSize == OsdSize480i||CurrentOsdSize == OsdSize480iCVBS ||CurrentOsdSize == OsdSize480p)
			{
				video_frame[0] = 80;
				video_frame[1] = 120;
				video_frame[2] = 480;
				video_frame[3] = 320;
			}else if(CurrentOsdSize == OsdSize576i ||CurrentOsdSize == OsdSize576iCVBS||CurrentOsdSize == OsdSize576p)
			{
				video_frame[0] = 96;
				video_frame[1] = 120;
				video_frame[2] = 480;
				video_frame[3] = 384;
			}
			else
			{
				video_frame[0] = 120;
				video_frame[1] = 214;
				video_frame[2] = 853;
				video_frame[3] = 480;
			}			

		break;
		case 3://3
			if(CurrentOsdSize == OsdSize480i||CurrentOsdSize == OsdSize480iCVBS ||CurrentOsdSize == OsdSize480p)
			{
				video_frame[0] = 120;
				video_frame[1] = 180;
				video_frame[2] = 360;
				video_frame[3] = 240;
			}else if(CurrentOsdSize == OsdSize576i ||CurrentOsdSize == OsdSize576iCVBS||CurrentOsdSize == OsdSize576p)
			{
				video_frame[0] = 144;
				video_frame[1] = 180;
				video_frame[2] = 360;
				video_frame[3] = 288;
			}
			else
			{
				video_frame[0] = 180;
				video_frame[1] = 320;
				video_frame[2] = 640;
				video_frame[3] = 360;		
			}			
        break;
		/*case 3:
			if(CurrentOsdSize == OsdSize480i ||OsdSize480i == OsdSize480iCVBS ||CurrentOsdSize == OsdSize480p)
			{
				video_frame[0] = 160;
				video_frame[1] = 240;
				video_frame[2] = 240;
				video_frame[3] = 160;
			}else if(CurrentOsdSize == OsdSize576i ||OsdSize480i == OsdSize576iCVBS||CurrentOsdSize == OsdSize576p)
			{
				video_frame[0] = 192;
				video_frame[1] = 240;
				video_frame[2] = 240;
				video_frame[3] = 192;
			}else
			{
				video_frame[0] = 240;
				video_frame[1] = 427;
				video_frame[2] = 427;
				video_frame[3] = 240;
			}	
		break;*/
		default:
		break;
	}


//setup video display 
	ioctl(video_fd, VIDEOIO_SET_POSITION, &video_frame);
	video_appmode.zoom_level = 0;
	ioctl(video_fd, VIDEOIO_GETMODE, &video_appmode) ;
	ioctl(video_fd, VIDEOIO_FORCESETAPPMODE, &video_appmode) ;

}
#endif


